@tsparticles/engine 4.0.0-beta.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/browser/Core/CanvasManager.js +74 -37
  2. package/browser/Core/Engine.js +23 -8
  3. package/browser/Core/Particle.js +3 -3
  4. package/browser/Core/ParticlesManager.js +157 -78
  5. package/browser/Core/Retina.js +2 -3
  6. package/browser/Core/Utils/EventListeners.js +1 -1
  7. package/browser/Options/Classes/Particles/Fill.js +0 -2
  8. package/browser/Options/Classes/Particles/Paint.js +25 -0
  9. package/browser/Options/Classes/Particles/ParticlesOptions.js +54 -48
  10. package/browser/Utils/CanvasUtils.js +3 -3
  11. package/browser/Utils/LogUtils.js +32 -15
  12. package/browser/Utils/Utils.js +1 -0
  13. package/browser/browser.js +5 -0
  14. package/browser/exports.js +1 -0
  15. package/browser/index.js +0 -1
  16. package/cjs/Core/CanvasManager.js +74 -37
  17. package/cjs/Core/Engine.js +23 -8
  18. package/cjs/Core/Particle.js +3 -3
  19. package/cjs/Core/ParticlesManager.js +157 -78
  20. package/cjs/Core/Retina.js +2 -3
  21. package/cjs/Core/Utils/EventListeners.js +1 -1
  22. package/cjs/Options/Classes/Particles/Fill.js +0 -2
  23. package/cjs/Options/Classes/Particles/Paint.js +25 -0
  24. package/cjs/Options/Classes/Particles/ParticlesOptions.js +54 -48
  25. package/cjs/Utils/CanvasUtils.js +3 -3
  26. package/cjs/Utils/LogUtils.js +32 -15
  27. package/cjs/Utils/Utils.js +1 -0
  28. package/cjs/browser.js +5 -0
  29. package/cjs/exports.js +1 -0
  30. package/cjs/index.js +0 -1
  31. package/esm/Core/CanvasManager.js +74 -37
  32. package/esm/Core/Engine.js +23 -8
  33. package/esm/Core/Particle.js +3 -3
  34. package/esm/Core/ParticlesManager.js +157 -78
  35. package/esm/Core/Retina.js +2 -3
  36. package/esm/Core/Utils/EventListeners.js +1 -1
  37. package/esm/Options/Classes/Particles/Fill.js +0 -2
  38. package/esm/Options/Classes/Particles/Paint.js +25 -0
  39. package/esm/Options/Classes/Particles/ParticlesOptions.js +54 -48
  40. package/esm/Utils/CanvasUtils.js +3 -3
  41. package/esm/Utils/LogUtils.js +32 -15
  42. package/esm/Utils/Utils.js +1 -0
  43. package/esm/browser.js +5 -0
  44. package/esm/exports.js +1 -0
  45. package/esm/index.js +0 -1
  46. package/package.json +8 -1
  47. package/report.html +4949 -94
  48. package/scripts/install.js +321 -220
  49. package/tsparticles.engine.js +5293 -939
  50. package/tsparticles.engine.min.js +1 -2
  51. package/types/Core/CanvasManager.d.ts +3 -2
  52. package/types/Core/Container.d.ts +1 -2
  53. package/types/Core/Interfaces/IContainerPlugin.d.ts +7 -8
  54. package/types/Core/Interfaces/IDrawParticleParams.d.ts +1 -2
  55. package/types/Core/Interfaces/ILoadParams.d.ts +1 -1
  56. package/types/Core/Interfaces/IPalette.d.ts +4 -2
  57. package/types/Core/Interfaces/IParticleUpdater.d.ts +1 -2
  58. package/types/Core/Interfaces/IShapeDrawData.d.ts +1 -2
  59. package/types/Core/Particle.d.ts +1 -0
  60. package/types/Core/ParticlesManager.d.ts +11 -5
  61. package/types/Core/RenderManager.d.ts +2 -3
  62. package/types/Core/Utils/PluginManager.d.ts +5 -6
  63. package/types/Options/Classes/Options.d.ts +1 -2
  64. package/types/Options/Classes/Particles/Fill.d.ts +1 -1
  65. package/types/Options/Classes/Particles/Paint.d.ts +12 -0
  66. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +2 -4
  67. package/types/Options/Interfaces/Particles/IPaint.d.ts +10 -0
  68. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +2 -4
  69. package/types/Utils/CanvasUtils.d.ts +4 -5
  70. package/types/Utils/LogUtils.d.ts +2 -3
  71. package/types/Utils/Utils.d.ts +1 -2
  72. package/types/browser.d.ts +1 -0
  73. package/types/export-types.d.ts +1 -1
  74. package/types/exports.d.ts +1 -0
  75. package/types/{bundle.d.ts → index.lazy.d.ts} +1 -0
  76. package/67.min.js +0 -1
  77. package/dist_browser_Core_Container_js.js +0 -102
  78. package/types/Types/CanvasContextType.d.ts +0 -1
  79. /package/browser/{Types/CanvasContextType.js → Options/Interfaces/Particles/IPaint.js} +0 -0
  80. /package/browser/{bundle.js → index.lazy.js} +0 -0
  81. /package/cjs/{Types/CanvasContextType.js → Options/Interfaces/Particles/IPaint.js} +0 -0
  82. /package/cjs/{bundle.js → index.lazy.js} +0 -0
  83. /package/esm/{Types/CanvasContextType.js → Options/Interfaces/Particles/IPaint.js} +0 -0
  84. /package/esm/{bundle.js → index.lazy.js} +0 -0
@@ -1,251 +1,352 @@
1
1
  import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
2
  import fs from "fs-extra";
4
3
 
5
- async function checkErrors() {
6
- const angularParticlesFoundError = "ng-particles-found",
7
- particlesJsFoundError = "particles.js-found",
8
- reactParticlesJsFoundError = "react-particles-js-found",
9
- reactParticlesFoundError = "react-particles-found",
10
- reactTsParticlesFoundError = "react-tsparticles-found",
11
- vue2ParticlesFoundError = "vue2-particles-found",
12
- vue3ParticlesFoundError = "vue3-particles-found";
13
-
14
- try {
15
- console.log("Thank you for installing tsParticles.");
16
- console.log("Remember to checkout the official website https://particles.js.org to explore some samples.");
17
- console.log("You can find more samples on CodePen too: https://codepen.io/collection/DPOage");
18
- console.log("If you need documentation you can find it here: https://particles.js.org/docs");
19
- console.log(
20
- "Don't forget to star the tsParticles repository, if you like the project and want to support it: https://github.com/tsparticles/tsparticles"
21
- );
22
-
23
- const rootPkgPath = path.join(process.env.INIT_CWD, "package.json"),
24
- pkgSettings = await fs.readJson(rootPkgPath);
25
-
26
- if (!pkgSettings) {
27
- return;
4
+ const ERR_INCOMPATIBLE = "incompatible-package-found",
5
+ ERR_DEPRECATED = "deprecated-package-found",
6
+ incompatible = [
7
+ {
8
+ package: "particles.js",
9
+ message:
10
+ "The package particles.js can't be installed with tsparticles, since it can lead to unexpected behaviors. Please uninstall particles.js and remove it from the package.json file.",
11
+ },
12
+ {
13
+ package: "particlesjs",
14
+ message:
15
+ "The package particlesjs can't be installed with tsparticles, since it can lead to unexpected behaviors. Please uninstall particlesjs and remove it from the package.json file.",
16
+ },
17
+ ],
18
+ deprecated = [
19
+ {
20
+ package: "react-particles-js",
21
+ replacement: "@tsparticles/react",
22
+ message: "The package react-particles-js has been deprecated and is not supported anymore.",
23
+ },
24
+ {
25
+ package: "react-tsparticles",
26
+ replacement: "@tsparticles/react",
27
+ message: "The package react-tsparticles has been deprecated and is not supported anymore.",
28
+ },
29
+ {
30
+ package: "react-particles",
31
+ replacement: "@tsparticles/react",
32
+ message: "The package react-particles has been deprecated and is not supported anymore.",
33
+ },
34
+ {
35
+ package: "ng-particles",
36
+ replacement: "@tsparticles/angular",
37
+ message: "The package ng-particles has been deprecated and is not supported anymore.",
38
+ },
39
+ {
40
+ package: "vue3-particles",
41
+ replacement: "@tsparticles/vue3",
42
+ message: "The package vue3-particles has been deprecated and is not supported anymore.",
43
+ },
44
+ {
45
+ package: "vue2-particles",
46
+ replacement: "@tsparticles/vue2",
47
+ message: "The package vue2-particles has been deprecated and is not supported anymore.",
48
+ },
49
+ ],
50
+ wrappers = [
51
+ {
52
+ framework: "react",
53
+ detector: deps => deps["react"] || deps["next"],
54
+ wrapper: "@tsparticles/react",
55
+ message:
56
+ "Found React installed. Please install @tsparticles/react to use tsParticles with a component ready to use and easier to configure.",
57
+ url: "https://github.com/tsparticles/react/#readme",
58
+ },
59
+ {
60
+ framework: "nextjs",
61
+ detector: deps => deps["next"],
62
+ wrapper: "@tsparticles/nextjs",
63
+ message:
64
+ "Found Next.js installed. Please install @tsparticles/nextjs to use tsParticles with a component optimized for Next.js.",
65
+ url: "https://github.com/tsparticles/nextjs/#readme",
66
+ },
67
+ {
68
+ framework: "angular",
69
+ detector: deps => deps["@angular/core"],
70
+ wrapper: "@tsparticles/angular",
71
+ message:
72
+ "Found Angular installed. Please install @tsparticles/angular to use tsParticles with a component ready to use and easier to configure.",
73
+ url: "https://github.com/tsparticles/angular/#readme",
74
+ },
75
+ {
76
+ framework: "vue3",
77
+ detector: deps => {
78
+ if (deps["nuxt"]) {
79
+ return false;
28
80
  }
29
81
 
30
- const dependencies = pkgSettings.dependencies;
31
-
32
- if (!dependencies) {
33
- return;
82
+ const version = deps["vue"];
83
+
84
+ return version && parseInt(version) > 2;
85
+ },
86
+ wrapper: "@tsparticles/vue3",
87
+ message:
88
+ "Found Vue 3.x installed. Please install @tsparticles/vue3 to use tsParticles with a component ready to use and easier to configure.",
89
+ url: "https://github.com/tsparticles/vue3/#readme",
90
+ },
91
+ {
92
+ framework: "vue2",
93
+ detector: deps => {
94
+ if (deps["nuxt"]) {
95
+ return false;
34
96
  }
35
97
 
36
- if (dependencies["particles.js"]) {
37
- console.error(
38
- "\x1b[31m%s\x1b[0m",
39
- "The package particles.js can't be installed with tsparticles, since it can lead to unexpected behaviors, please uninstall particles.js and remove it from the package.json file."
40
- );
98
+ const version = deps["vue"];
99
+
100
+ return version && parseInt(version) === 2;
101
+ },
102
+ wrapper: "@tsparticles/vue2",
103
+ message:
104
+ "Found Vue 2.x installed. Please install @tsparticles/vue2 to use tsParticles with a component ready to use and easier to configure.",
105
+ url: "https://github.com/tsparticles/vue2/#readme",
106
+ },
107
+ {
108
+ wrapper: "@tsparticles/vue3",
109
+ message:
110
+ "Found Vue 3.x installed. Please install @tsparticles/vue3 to use tsParticles with a component ready to use and easier to configure.",
111
+ url: "https://github.com/tsparticles/vue3/#readme",
112
+ },
113
+ {
114
+ framework: "vue2",
115
+ detector: deps => {
116
+ const vue = deps["vue"],
117
+ nuxt = deps["nuxt"],
118
+ version = vue || nuxt;
119
+
120
+ return version && parseInt(version) === 2;
121
+ },
122
+ wrapper: "@tsparticles/vue2",
123
+ message:
124
+ "Found Vue 2.x installed. Please install @tsparticles/vue2 to use tsParticles with a component ready to use and easier to configure.",
125
+ url: "https://github.com/tsparticles/vue2/#readme",
126
+ },
127
+ {
128
+ framework: "nuxt",
129
+ detector: deps => deps["nuxt"],
130
+ wrapper: null,
131
+ dynamic: true,
132
+ nuxtWrappers: [
133
+ { minVersion: 4, wrapper: "@tsparticles/nuxt4", url: "https://github.com/tsparticles/nuxt4/#readme" },
134
+ { minVersion: 3, wrapper: "@tsparticles/nuxt3", url: "https://github.com/tsparticles/nuxt3/#readme" },
135
+ { minVersion: 0, wrapper: "@tsparticles/nuxt2", url: "https://github.com/tsparticles/nuxt2/#readme" },
136
+ ],
137
+ message: version => {
138
+ const major = parseInt(version);
139
+
140
+ if (major >= 4) {
141
+ return "Found Nuxt 4.x installed. Please install @tsparticles/nuxt4 to use tsParticles with a component optimized for Nuxt 4.";
142
+ }
41
143
 
42
- throw new Error(reactParticlesJsFoundError);
144
+ if (major >= 3) {
145
+ return "Found Nuxt 3.x installed. Please install @tsparticles/nuxt3 to use tsParticles with a component optimized for Nuxt 3.";
43
146
  }
44
147
 
45
- if (dependencies["particlesjs"]) {
46
- console.error(
47
- "\x1b[31m%s\x1b[0m",
48
- "The package particlesjs can't be installed with tsparticles, since it can lead to unexpected behaviors, please uninstall particlesjs and remove it from the package.json file."
49
- );
148
+ return "Found Nuxt 2.x installed. Please install @tsparticles/nuxt2 to use tsParticles with a component optimized for Nuxt 2.";
149
+ },
150
+ },
151
+ {
152
+ framework: "svelte",
153
+ detector: deps => deps["svelte"],
154
+ wrapper: "@tsparticles/svelte",
155
+ message:
156
+ "Found Svelte installed. Please install @tsparticles/svelte to use tsParticles with a component ready to use and easier to configure.",
157
+ url: "https://github.com/tsparticles/svelte/#readme",
158
+ },
159
+ {
160
+ framework: "solid",
161
+ detector: deps => deps["solid-js"],
162
+ wrapper: "@tsparticles/solid",
163
+ message:
164
+ "Found Solid.js installed. Please install @tsparticles/solid to use tsParticles with a component ready to use and easier to configure.",
165
+ url: "https://github.com/tsparticles/solid/#readme",
166
+ },
167
+ {
168
+ framework: "preact",
169
+ detector: deps => deps["preact"],
170
+ wrapper: "@tsparticles/preact",
171
+ message:
172
+ "Found Preact installed. Please install @tsparticles/preact to use tsParticles with a component ready to use and easier to configure.",
173
+ url: "https://github.com/tsparticles/preact/#readme",
174
+ },
175
+ {
176
+ framework: "inferno",
177
+ detector: deps => deps["inferno"],
178
+ wrapper: "@tsparticles/inferno",
179
+ message:
180
+ "Found Inferno installed. Please install @tsparticles/inferno to use tsParticles with a component ready to use and easier to configure.",
181
+ url: "https://github.com/tsparticles/inferno/#readme",
182
+ },
183
+ {
184
+ framework: "jquery",
185
+ detector: deps => deps["jquery"],
186
+ wrapper: "@tsparticles/jquery",
187
+ message:
188
+ "Found jQuery installed. Please install @tsparticles/jquery to use tsParticles with a plugin ready to use and easier to configure.",
189
+ url: "https://github.com/tsparticles/jquery/#readme",
190
+ },
191
+ {
192
+ framework: "riot",
193
+ detector: deps => deps["riot"],
194
+ wrapper: "@tsparticles/riot",
195
+ message:
196
+ "Found Riot.js installed. Please install @tsparticles/riot to use tsParticles with a component ready to use and easier to configure.",
197
+ url: "https://github.com/tsparticles/riot/#readme",
198
+ },
199
+ {
200
+ framework: "lit",
201
+ detector: deps => deps["lit"],
202
+ wrapper: "@tsparticles/lit",
203
+ message:
204
+ "Found Lit installed. Please install @tsparticles/lit to use tsParticles with a component ready to use and easier to configure.",
205
+ url: "https://github.com/tsparticles/lit/#readme",
206
+ },
207
+ {
208
+ framework: "ember",
209
+ detector: deps => deps["ember-source"],
210
+ wrapper: "@tsparticles/ember",
211
+ message:
212
+ "Found Ember.js installed. Please install @tsparticles/ember to use tsParticles with a component ready to use and easier to configure.",
213
+ url: "https://github.com/tsparticles/ember/#readme",
214
+ },
215
+ {
216
+ framework: "qwik",
217
+ detector: deps => deps["@builder.io/qwik"],
218
+ wrapper: "@tsparticles/qwik",
219
+ message:
220
+ "Found Qwik installed. Please install @tsparticles/qwik to use tsParticles with a component ready to use and easier to configure.",
221
+ url: "https://github.com/tsparticles/qwik/#readme",
222
+ },
223
+ {
224
+ framework: "astro",
225
+ detector: deps => deps["astro"],
226
+ wrapper: "@tsparticles/astro",
227
+ message:
228
+ "Found Astro installed. Please install @tsparticles/astro to use tsParticles with a component ready to use and easier to configure.",
229
+ url: "https://github.com/tsparticles/astro/#readme",
230
+ },
231
+ {
232
+ framework: "webcomponents",
233
+ detector: deps => true,
234
+ wrapper: "@tsparticles/webcomponents",
235
+ message:
236
+ "You can also use @tsparticles/webcomponents to use tsParticles as a standard Web Component, framework-agnostic.",
237
+ url: "https://github.com/tsparticles/webcomponents/#readme",
238
+ alwaysSuggest: true,
239
+ },
240
+ ];
241
+
242
+ function logInfo(msg) {
243
+ console.log(msg);
244
+ }
50
245
 
51
- throw new Error(reactParticlesJsFoundError);
52
- }
246
+ function logWarn(msg) {
247
+ console.warn("\x1b[43m\x1b[30m%s\x1b[0m", msg);
248
+ }
53
249
 
54
- if (dependencies["react-particles-js"]) {
55
- console.error(
56
- "\x1b[31m%s\x1b[0m",
57
- "The package react-particles-js has been deprecated and is not supported anymore."
58
- );
59
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to react-particles package.");
60
- console.error(
61
- "\x1b[31m%s\x1b[0m",
62
- "This error will be fixed once react-particles-js is removed from the package.json file."
63
- );
64
-
65
- throw new Error(reactParticlesJsFoundError);
66
- }
250
+ function logError(msg) {
251
+ console.error("\x1b[31m%s\x1b[0m", msg);
252
+ }
67
253
 
68
- if (dependencies["react-tsparticles"]) {
69
- console.error(
70
- "\x1b[31m%s\x1b[0m",
71
- "The package react-tsparticles has been deprecated and is not supported anymore."
72
- );
73
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to @tsparticles/react package.");
74
- console.error(
75
- "\x1b[31m%s\x1b[0m",
76
- "This error will be fixed once react-tsparticles is removed from the package.json file."
77
- );
78
-
79
- throw new Error(reactTsParticlesFoundError);
80
- }
254
+ function checkIncompatible(dependencies) {
255
+ for (const entry of incompatible) {
256
+ if (dependencies[entry.package]) {
257
+ logError(entry.message);
81
258
 
82
- if (dependencies["react-particles"]) {
83
- console.error(
84
- "\x1b[31m%s\x1b[0m",
85
- "The package react-particles has been deprecated and is not supported anymore."
86
- );
87
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to @tsparticles/react package.");
88
- console.error(
89
- "\x1b[31m%s\x1b[0m",
90
- "This error will be fixed once react-particles is removed from the package.json file."
91
- );
92
-
93
- throw new Error(reactParticlesFoundError);
94
- }
259
+ throw new Error(ERR_INCOMPATIBLE);
260
+ }
261
+ }
262
+ }
95
263
 
96
- if (dependencies["react"] || dependencies["next"]) {
97
- if (!dependencies["@tsparticles/react"]) {
98
- console.warn(
99
- "\x1b[43m\x1b[30m%s\x1b[0m",
100
- "Found React installed. Please download react-particles to use tsParticles with a component ready to use and easier to configure."
101
- );
102
- console.log(
103
- "You can read more about the component here: https://github.com/tsparticles/react/#readme"
104
- );
105
- }
106
- }
264
+ function checkDeprecated(dependencies) {
265
+ for (const entry of deprecated) {
266
+ if (dependencies[entry.package]) {
267
+ logError(entry.message);
268
+ logError(`Please consider switching to ${entry.replacement} instead.`);
269
+ logError("This warning will be resolved once the deprecated package is removed from package.json.");
107
270
 
108
- if (dependencies["ng-particles"]) {
109
- console.error(
110
- "\x1b[31m%s\x1b[0m",
111
- "The package ng-particles has been deprecated and is not supported anymore."
112
- );
113
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to @tsparticles/angular package.");
114
- console.error(
115
- "\x1b[31m%s\x1b[0m",
116
- "This error will be fixed once ng-particles is removed from the package.json file."
117
- );
118
-
119
- throw new Error(angularParticlesFoundError);
120
- }
271
+ throw new Error(ERR_DEPRECATED);
272
+ }
273
+ }
274
+ }
121
275
 
122
- if (dependencies["@angular/core"]) {
123
- if (!dependencies["@tsparticles/angular"]) {
124
- console.warn(
125
- "\x1b[43m\x1b[30m%s\x1b[0m",
126
- "Found Angular installed. Please download ng-particles to use tsParticles with a component ready to use and easier to configure."
127
- );
128
- console.log("You can read more about the component here: https://github.com/tsparticles/angular/#readme");
129
- }
130
- }
276
+ function checkWrappers(dependencies) {
277
+ for (const w of wrappers) {
278
+ if (!w.detector(dependencies)) {
279
+ continue;
280
+ }
131
281
 
132
- if (dependencies["vue3-particles"]) {
133
- console.error(
134
- "\x1b[31m%s\x1b[0m",
135
- "The package vue3-particles has been deprecated and is not supported anymore."
136
- );
137
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to @tsparticles/vue3 package.");
138
- console.error(
139
- "\x1b[31m%s\x1b[0m",
140
- "This error will be fixed once vue3-particles is removed from the package.json file."
141
- );
142
-
143
- throw new Error(vue3ParticlesFoundError);
144
- }
282
+ if (w.alwaysSuggest && dependencies[w.wrapper]) {
283
+ continue;
284
+ }
145
285
 
146
- if (dependencies["vue2-particles"]) {
147
- console.error(
148
- "\x1b[31m%s\x1b[0m",
149
- "The package vue2-particles has been deprecated and is not supported anymore."
150
- );
151
- console.error("\x1b[31m%s\x1b[0m", "Please consider switching to @tsparticles/vue2 package.");
152
- console.error(
153
- "\x1b[31m%s\x1b[0m",
154
- "This error will be fixed once vue2-particles is removed from the package.json file."
155
- );
156
-
157
- throw new Error(vue2ParticlesFoundError);
158
- }
286
+ if (w.dynamic && w.nuxtWrappers) {
287
+ const nuxtVersion = dependencies["nuxt"],
288
+ major = parseInt(nuxtVersion) || 0;
159
289
 
160
- if (dependencies["vue"] || dependencies["nuxt"]) {
161
- const vueVersion = dependencies["vue"],
162
- nuxtVersion = dependencies["nuxt"],
163
- vueMajor = (vueVersion || nuxtVersion).split(".")[0];
164
-
165
- if (vueMajor > 2) {
166
- if (!dependencies["@tsparticles/vue3"]) {
167
- console.warn(
168
- "\x1b[43m\x1b[30m%s\x1b[0m",
169
- "Found Vue 3.x installed. Please Download @tsparticles/vue3 to use tsParticles with a component ready to use and easier to configure."
170
- );
171
- console.log(
172
- "You can read more about the component here: https://github.com/tsparticles/vue3/#readme"
173
- );
174
- }
175
- } else {
176
- if (!dependencies["@tsparticles/vue2"]) {
177
- console.warn(
178
- "\x1b[43m\x1b[30m%s\x1b[0m",
179
- "Found Vue 2.x installed. Please Download @tsparticles/vue2 to use tsParticles with a component ready to use and easier to configure."
180
- );
181
- console.log(
182
- "You can read more about the component here: https://github.com/tsparticles/vue2/#readme"
183
- );
184
- }
185
- }
186
- }
290
+ let match;
187
291
 
188
- if (dependencies["svelte"]) {
189
- if (!dependencies["@tsparticles/svelte"]) {
190
- console.warn(
191
- "\x1b[43m\x1b[30m%s\x1b[0m",
192
- "Found Svelte installed. Please Download @tsparticles/svelte to use tsParticles with a component ready to use and easier to configure."
193
- );
194
- console.log(
195
- "You can read more about the component here: https://github.com/tsparticles/svelte/#readme"
196
- );
197
- }
292
+ for (const nw of w.nuxtWrappers) {
293
+ if (major >= nw.minVersion) {
294
+ match = nw;
295
+ break;
198
296
  }
297
+ }
199
298
 
200
- if (dependencies["inferno"]) {
201
- if (!dependencies["inferno-particles"]) {
202
- console.warn(
203
- "\x1b[43m\x1b[30m%s\x1b[0m",
204
- "Found Inferno installed. Please Download inferno-particles to use tsParticles with a component ready to use and easier to configure."
205
- );
206
- console.log(
207
- "You can read more about the component here: https://github.com/tsparticles/tsparticles/blob/main/components/inferno/README.md"
208
- );
209
- }
299
+ if (match) {
300
+ if (!dependencies[match.wrapper]) {
301
+ logWarn(w.message(nuxtVersion));
302
+ logInfo(`You can read more here: ${match.url}`);
210
303
  }
304
+ }
211
305
 
212
- if (dependencies["preact"]) {
213
- if (!dependencies["preact-particles"]) {
214
- console.warn(
215
- "\x1b[43m\x1b[30m%s\x1b[0m",
216
- "Found Preact installed. Please Download preact-particles to use tsParticles with a component ready to use and easier to configure."
217
- );
218
- console.log(
219
- "You can read more about the component here: https://github.com/tsparticles/tsparticles/blob/main/components/preact/README.md"
220
- );
221
- }
222
- }
306
+ continue;
307
+ }
223
308
 
224
- if (dependencies["jquery"]) {
225
- if (!dependencies["jquery-particles"]) {
226
- console.warn(
227
- "\x1b[43m\x1b[30m%s\x1b[0m",
228
- "Found jQuery installed. Please Download jquery-particles to use tsParticles with a plugin ready to use and easier to configure."
229
- );
230
- console.log(
231
- "You can read more about the plugin here: https://github.com/tsparticles/tsparticles/blob/main/components/jquery/README.md"
232
- );
233
- }
234
- }
235
- } catch (error) {
236
- if (error.message === reactParticlesJsFoundError ||
237
- error.message === particlesJsFoundError ||
238
- error.message === reactParticlesFoundError ||
239
- error.message === reactTsParticlesFoundError ||
240
- error.message === angularParticlesFoundError ||
241
- error.message === vue2ParticlesFoundError ||
242
- error.message === vue3ParticlesFoundError
243
- ) {
244
- throw error;
245
- }
309
+ if (!dependencies[w.wrapper]) {
310
+ logWarn(w.message);
311
+ logInfo(`You can read more here: ${w.url}`);
312
+ }
313
+ }
314
+ }
246
315
 
247
- console.log(error);
316
+ async function checkErrors() {
317
+ const initialMessage =
318
+ "Thank you for installing tsParticles.\n" +
319
+ "Remember to checkout the official website https://particles.js.org to explore some samples.\n" +
320
+ "You can find more samples on CodePen too: https://codepen.io/collection/DPOage\n" +
321
+ "If you need documentation you can find it here: https://particles.js.org/docs\n" +
322
+ "Don't forget to star the tsParticles repository, if you like the project and want to support it: https://github.com/tsparticles/tsparticles";
323
+
324
+ try {
325
+ console.log(initialMessage);
326
+
327
+ const rootPkgPath = path.join(process.env.INIT_CWD, "package.json"),
328
+ pkgSettings = await fs.readJson(rootPkgPath);
329
+
330
+ if (!pkgSettings) {
331
+ return;
248
332
  }
333
+
334
+ const dependencies = pkgSettings.dependencies;
335
+
336
+ if (!dependencies) {
337
+ return;
338
+ }
339
+
340
+ checkIncompatible(dependencies);
341
+ checkDeprecated(dependencies);
342
+ checkWrappers(dependencies);
343
+ } catch (error) {
344
+ if (error.message === ERR_INCOMPATIBLE || error.message === ERR_DEPRECATED) {
345
+ throw error;
346
+ }
347
+
348
+ console.log(error);
349
+ }
249
350
  }
250
351
 
251
352
  checkErrors();