Skip to content

Commit 974513c

Browse files
committed
build: improved bundle loadings
1 parent dfe969d commit 974513c

5 files changed

Lines changed: 49 additions & 51 deletions

File tree

bundles/all/src/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,22 @@ export async function loadAll(engine: Engine): Promise<void> {
188188
import("@tsparticles/plugin-emitters-shape-polygon"),
189189
]);
190190

191-
await loadFull(e);
192-
193191
await Promise.all([
192+
loadFull(e).then(async () => {
193+
await Promise.all([
194+
loadExternalParticleInteraction(e),
195+
loadExternalPopInteraction(e),
196+
loadLightInteraction(e),
197+
loadParticlesRepulseInteraction(e),
198+
199+
loadInfectionPlugin(e),
200+
201+
loadEmittersShapeCanvas(e),
202+
loadEmittersShapePath(e),
203+
loadEmittersShapePolygon(e),
204+
]);
205+
}),
206+
194207
loadHsvColorPlugin(e),
195208
loadHwbColorPlugin(e),
196209
loadLabColorPlugin(e),
@@ -265,18 +278,5 @@ export async function loadAll(engine: Engine): Promise<void> {
265278
loadSpiralShape(e),
266279
loadSquircleShape(e),
267280
]);
268-
269-
await Promise.all([
270-
loadExternalParticleInteraction(e),
271-
loadExternalPopInteraction(e),
272-
loadLightInteraction(e),
273-
loadParticlesRepulseInteraction(e),
274-
275-
loadInfectionPlugin(e),
276-
277-
loadEmittersShapeCanvas(e),
278-
loadEmittersShapePath(e),
279-
loadEmittersShapePolygon(e),
280-
]);
281281
});
282282
}

bundles/confetti/src/confetti.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ async function initPlugins(engine: Engine): Promise<void> {
138138
import("@tsparticles/updater-wobble"),
139139
]);
140140

141-
await loadBasic(e);
142-
143141
await Promise.all([
142+
loadBasic(e),
144143
loadMotionPlugin(e),
145144
loadEmittersPlugin(e),
146145
loadCardSuitsShape(e),

bundles/fireworks/src/fireworks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ async function initPlugins(engine: Engine): Promise<void> {
9898
import("@tsparticles/effect-trail"),
9999
]);
100100

101-
await loadBasic(e);
102-
103101
await Promise.all([
102+
loadBasic(e),
104103
loadEmittersPlugin(e),
105104
loadSoundsPlugin(e),
106105
loadRotateUpdater(e),

bundles/full/src/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ export async function loadFull(engine: Engine): Promise<void> {
4747
]);
4848

4949
await Promise.all([
50-
loadSlim(e),
50+
loadSlim(e).then(async () => {
51+
await Promise.all([
52+
loadExternalTrailInteraction(e),
53+
54+
loadAbsorbersPlugin(e),
55+
loadEmittersPlugin(e).then(async () => {
56+
await Promise.all([
57+
loadEmittersShapeCircle(e),
58+
loadEmittersShapeSquare(e),
59+
]);
60+
}),
61+
]);
62+
}),
5163

5264
loadDestroyUpdater(e),
5365
loadRollUpdater(e),
@@ -57,17 +69,5 @@ export async function loadFull(engine: Engine): Promise<void> {
5769

5870
loadTextShape(e),
5971
]);
60-
61-
await Promise.all([
62-
loadExternalTrailInteraction(e),
63-
64-
loadAbsorbersPlugin(e),
65-
loadEmittersPlugin(e),
66-
]);
67-
68-
await Promise.all([
69-
loadEmittersShapeCircle(e),
70-
loadEmittersShapeSquare(e),
71-
]);
7272
});
7373
}

bundles/slim/src/index.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,25 @@ export async function loadSlim(engine: Engine): Promise<void> {
8181
await Promise.all([
8282
loadBasic(e),
8383

84-
loadInteractivityPlugin(e),
84+
loadInteractivityPlugin(e).then(async () => {
85+
await Promise.all([
86+
loadExternalParallaxInteraction(e),
87+
loadExternalAttractInteraction(e),
88+
loadExternalBounceInteraction(e),
89+
loadExternalBubbleInteraction(e),
90+
loadExternalConnectInteraction(e),
91+
loadExternalGrabInteraction(e),
92+
loadExternalPauseInteraction(e),
93+
loadExternalPushInteraction(e),
94+
loadExternalRemoveInteraction(e),
95+
loadExternalRepulseInteraction(e),
96+
loadExternalSlowInteraction(e),
97+
98+
loadParticlesAttractInteraction(e),
99+
loadParticlesCollisionsInteraction(e),
100+
loadParticlesLinksInteraction(e),
101+
]);
102+
}),
85103

86104
loadEasingQuadPlugin(e),
87105

@@ -96,23 +114,5 @@ export async function loadSlim(engine: Engine): Promise<void> {
96114
loadRotateUpdater(e),
97115
loadStrokeColorUpdater(e),
98116
]);
99-
100-
await Promise.all([
101-
loadExternalParallaxInteraction(e),
102-
loadExternalAttractInteraction(e),
103-
loadExternalBounceInteraction(e),
104-
loadExternalBubbleInteraction(e),
105-
loadExternalConnectInteraction(e),
106-
loadExternalGrabInteraction(e),
107-
loadExternalPauseInteraction(e),
108-
loadExternalPushInteraction(e),
109-
loadExternalRemoveInteraction(e),
110-
loadExternalRepulseInteraction(e),
111-
loadExternalSlowInteraction(e),
112-
113-
loadParticlesAttractInteraction(e),
114-
loadParticlesCollisionsInteraction(e),
115-
loadParticlesLinksInteraction(e),
116-
]);
117117
});
118118
}

0 commit comments

Comments
 (0)