@tsparticles/rollup-plugin 3.4.14
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.
- package/LICENSE +21 -0
- package/dist/buildMap.d.ts +11 -0
- package/dist/buildMap.d.ts.map +1 -0
- package/dist/config/createConfig.d.ts +4 -0
- package/dist/config/createConfig.d.ts.map +1 -0
- package/dist/config/createSingleConfig.d.ts +4 -0
- package/dist/config/createSingleConfig.d.ts.map +1 -0
- package/dist/config/entry.d.ts +12 -0
- package/dist/config/entry.d.ts.map +1 -0
- package/dist/config/externals.d.ts +11 -0
- package/dist/config/externals.d.ts.map +1 -0
- package/dist/createParticlesBuild.d.ts +4 -0
- package/dist/createParticlesBuild.d.ts.map +1 -0
- package/dist/index.cjs +229 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +211 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Matteo Bruni
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ParticlesBuildType = "bundle" | "effect" | "engine" | "interaction" | "interactionExternal" | "interactionParticles" | "palette" | "path" | "plugin" | "pluginEasing" | "pluginEmittersShape" | "pluginExport" | "preset" | "shape" | "template" | "updater";
|
|
2
|
+
import type { ParticlesBuildParams } from "./types";
|
|
3
|
+
interface BuildDefinition {
|
|
4
|
+
format: string;
|
|
5
|
+
hasBundle?: boolean;
|
|
6
|
+
banner: (p: ParticlesBuildParams) => string;
|
|
7
|
+
minBanner: (p: ParticlesBuildParams) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare const buildMap: Record<ParticlesBuildType, BuildDefinition>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=buildMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildMap.d.ts","sourceRoot":"","sources":["../src/buildMap.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,qBAAqB,GACrB,sBAAsB,GACtB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,SAAS,CAAC;AAEd,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC;IAC5C,SAAS,EAAE,CAAC,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC;CAChD;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAsFhE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConfig.d.ts","sourceRoot":"","sources":["../../src/config/createConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5C,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,KAAG,aAAa,EAOhE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSingleConfig.d.ts","sourceRoot":"","sources":["../../src/config/createSingleConfig.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,YAAY,EACpB,KAAK,OAAO,EACZ,MAAM,OAAO,KACZ,aAmCF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface EntryParams {
|
|
2
|
+
bundle: boolean;
|
|
3
|
+
format: string;
|
|
4
|
+
lazy: boolean;
|
|
5
|
+
min: boolean;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const getEntry: (data: EntryParams) => {
|
|
9
|
+
name: string;
|
|
10
|
+
input: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/config/entry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,GAAI,MAAM,WAAW;;;CAazC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExternalData } from "../types";
|
|
2
|
+
interface Params {
|
|
3
|
+
additionalExternals?: ExternalData[];
|
|
4
|
+
bundle?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const getExternal: ({ bundle, additionalExternals }: Params) => (string | RegExp)[];
|
|
7
|
+
export declare const getGlobals: (additionalExternals?: ExternalData[], bundle?: boolean) => {
|
|
8
|
+
[k: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=externals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externals.d.ts","sourceRoot":"","sources":["../../src/config/externals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,MAAM;IACd,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,GAAI,iCAAsC,MAAM,wBAWvE,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,sBAAqB,YAAY,EAAO,EACxC,SAAS,OAAO;;CASjB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ParticlesBuildType } from "./buildMap";
|
|
2
|
+
import type { ParticlesBuildParams } from "./types";
|
|
3
|
+
export declare const createParticlesBuild: (type: ParticlesBuildType, params: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
4
|
+
//# sourceMappingURL=createParticlesBuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createParticlesBuild.d.ts","sourceRoot":"","sources":["../src/createParticlesBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,oBAAoB,GAC/B,MAAM,kBAAkB,EACxB,QAAQ,oBAAoB,qCAmD7B,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('node:path');
|
|
4
|
+
var replace = require('@rollup/plugin-replace');
|
|
5
|
+
var terser = require('@rollup/plugin-terser');
|
|
6
|
+
var rollupPluginVisualizer = require('rollup-plugin-visualizer');
|
|
7
|
+
|
|
8
|
+
const buildMap = {
|
|
9
|
+
bundle: {
|
|
10
|
+
format: "",
|
|
11
|
+
hasBundle: true,
|
|
12
|
+
banner: ({ version }) => `tsParticles v${version}`,
|
|
13
|
+
minBanner: ({ version, bundleName }) => `tsParticles ${bundleName ?? ""} v${version}`,
|
|
14
|
+
},
|
|
15
|
+
effect: {
|
|
16
|
+
format: "effect",
|
|
17
|
+
banner: ({ version }) => `Effect v${version}`,
|
|
18
|
+
minBanner: ({ version, effectName }) => `tsParticles ${effectName} Effect v${version}`,
|
|
19
|
+
},
|
|
20
|
+
engine: {
|
|
21
|
+
format: "engine",
|
|
22
|
+
banner: ({ version }) => `tsParticles Engine v${version}`,
|
|
23
|
+
minBanner: ({ version }) => `tsParticles Engine v${version}`,
|
|
24
|
+
},
|
|
25
|
+
interaction: {
|
|
26
|
+
format: "interaction",
|
|
27
|
+
banner: ({ version }) => `Interaction v${version}`,
|
|
28
|
+
minBanner: ({ version }) => `Interaction v${version}`,
|
|
29
|
+
},
|
|
30
|
+
interactionExternal: {
|
|
31
|
+
format: "interaction.external",
|
|
32
|
+
banner: ({ version }) => `External Interaction v${version}`,
|
|
33
|
+
minBanner: ({ version }) => `External Interaction v${version}`,
|
|
34
|
+
},
|
|
35
|
+
interactionParticles: {
|
|
36
|
+
format: "interaction.particles",
|
|
37
|
+
banner: ({ version }) => `Particles Interaction v${version}`,
|
|
38
|
+
minBanner: ({ version }) => `Particles Interaction v${version}`,
|
|
39
|
+
},
|
|
40
|
+
palette: {
|
|
41
|
+
format: "palette",
|
|
42
|
+
banner: ({ version }) => `Palette v${version}`,
|
|
43
|
+
minBanner: ({ version }) => `Palette v${version}`,
|
|
44
|
+
},
|
|
45
|
+
path: {
|
|
46
|
+
format: "path",
|
|
47
|
+
banner: ({ version }) => `Path v${version}`,
|
|
48
|
+
minBanner: ({ version }) => `Path v${version}`,
|
|
49
|
+
},
|
|
50
|
+
plugin: {
|
|
51
|
+
format: "plugin",
|
|
52
|
+
banner: ({ version }) => `Plugin v${version}`,
|
|
53
|
+
minBanner: ({ version, pluginName }) => `tsParticles ${pluginName} Plugin v${version}`,
|
|
54
|
+
},
|
|
55
|
+
pluginEasing: {
|
|
56
|
+
format: "plugin.easing",
|
|
57
|
+
banner: ({ version }) => `Easing Plugin v${version}`,
|
|
58
|
+
minBanner: ({ version }) => `Easing Plugin v${version}`,
|
|
59
|
+
},
|
|
60
|
+
pluginEmittersShape: {
|
|
61
|
+
format: "plugin.emitters.shape",
|
|
62
|
+
banner: ({ version }) => `Emitters Shape v${version}`,
|
|
63
|
+
minBanner: ({ version }) => `Emitters Shape v${version}`,
|
|
64
|
+
},
|
|
65
|
+
pluginExport: {
|
|
66
|
+
format: "plugin.export",
|
|
67
|
+
banner: ({ version }) => `Export Plugin v${version}`,
|
|
68
|
+
minBanner: ({ version }) => `Export Plugin v${version}`,
|
|
69
|
+
},
|
|
70
|
+
preset: {
|
|
71
|
+
format: "preset",
|
|
72
|
+
hasBundle: true,
|
|
73
|
+
banner: ({ version }) => `Preset v${version}`,
|
|
74
|
+
minBanner: ({ version }) => `Preset v${version}`,
|
|
75
|
+
},
|
|
76
|
+
shape: {
|
|
77
|
+
format: "shape",
|
|
78
|
+
banner: ({ version }) => `Shape v${version}`,
|
|
79
|
+
minBanner: ({ version }) => `Shape v${version}`,
|
|
80
|
+
},
|
|
81
|
+
template: {
|
|
82
|
+
format: "template",
|
|
83
|
+
banner: ({ version }) => `Template v${version}`,
|
|
84
|
+
minBanner: ({ version }) => `Template v${version}`,
|
|
85
|
+
},
|
|
86
|
+
updater: {
|
|
87
|
+
format: "updater",
|
|
88
|
+
banner: ({ version }) => `Updater v${version}`,
|
|
89
|
+
minBanner: ({ version }) => `Updater v${version}`,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getEntry = (data) => {
|
|
94
|
+
const { bundle, format, lazy, min, name } = data, fileName = bundle ? "bundle" : "index", completeFileName = lazy ? `${fileName}.lazy` : fileName, fixFormat = format ? `.${format}` : "", fixName = name ? `.${name}` : "", fixMin = min ? ".min" : "", fixLazy = lazy ? ".lazy" : "";
|
|
95
|
+
return {
|
|
96
|
+
name: `tsparticles${fixFormat}${fixName}${fixLazy}${fixMin}`,
|
|
97
|
+
input: `./dist/browser/${completeFileName}.js`,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const getExternal = ({ bundle, additionalExternals = [] }) => {
|
|
102
|
+
if (bundle) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
return [
|
|
106
|
+
...additionalExternals.map(e => e.name),
|
|
107
|
+
/^tsparticles$/,
|
|
108
|
+
/^tsparticles-/,
|
|
109
|
+
/^@tsparticles\//,
|
|
110
|
+
];
|
|
111
|
+
};
|
|
112
|
+
const getGlobals = (additionalExternals = [], bundle) => {
|
|
113
|
+
if (bundle) {
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
return Object.fromEntries(additionalExternals.map(e => [e.name, "window"]));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const createSingleConfig = (params, min, lazy) => {
|
|
120
|
+
const { additionalExternals, banner, bundle, dir, entry, minBanner, version, } = params, { name, input } = getEntry({ ...entry, min, lazy });
|
|
121
|
+
return {
|
|
122
|
+
input,
|
|
123
|
+
external: getExternal({ bundle, additionalExternals }),
|
|
124
|
+
plugins: [
|
|
125
|
+
replace({
|
|
126
|
+
preventAssignment: true,
|
|
127
|
+
__VERSION__: JSON.stringify(version),
|
|
128
|
+
}),
|
|
129
|
+
!min &&
|
|
130
|
+
rollupPluginVisualizer.visualizer({
|
|
131
|
+
filename: path.resolve(dir, "dist/report.html"),
|
|
132
|
+
}),
|
|
133
|
+
min && terser(),
|
|
134
|
+
].filter(Boolean),
|
|
135
|
+
output: {
|
|
136
|
+
file: path.resolve(dir, "dist", `${name}.js`),
|
|
137
|
+
format: "umd",
|
|
138
|
+
name: "tsParticles",
|
|
139
|
+
globals: getGlobals(additionalExternals, bundle),
|
|
140
|
+
banner: min ? minBanner : banner,
|
|
141
|
+
inlineDynamicImports: true,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const createConfig = (params) => {
|
|
147
|
+
return [
|
|
148
|
+
createSingleConfig(params, false, false),
|
|
149
|
+
createSingleConfig(params, true, false),
|
|
150
|
+
createSingleConfig(params, false, true),
|
|
151
|
+
createSingleConfig(params, true, true),
|
|
152
|
+
];
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const createParticlesBuild = (type, params) => {
|
|
156
|
+
const def = buildMap[type];
|
|
157
|
+
if (!def) {
|
|
158
|
+
throw new Error(`Unknown build type: ${type}`);
|
|
159
|
+
}
|
|
160
|
+
const dir = params.dir, version = params.version, additionalExternals = params.additionalExternals, moduleName = params.moduleName, bundle = params.bundle, banner = def.banner(params), minBanner = def.minBanner(params), base = createConfig({
|
|
161
|
+
entry: {
|
|
162
|
+
format: def.format,
|
|
163
|
+
name: moduleName,
|
|
164
|
+
bundle: false,
|
|
165
|
+
},
|
|
166
|
+
version,
|
|
167
|
+
banner,
|
|
168
|
+
minBanner,
|
|
169
|
+
dir,
|
|
170
|
+
bundle: false,
|
|
171
|
+
additionalExternals,
|
|
172
|
+
});
|
|
173
|
+
if (def.hasBundle && (bundle ?? true)) {
|
|
174
|
+
return [
|
|
175
|
+
...base,
|
|
176
|
+
...createConfig({
|
|
177
|
+
entry: {
|
|
178
|
+
format: def.format,
|
|
179
|
+
name: moduleName
|
|
180
|
+
? `${moduleName}.bundle`
|
|
181
|
+
: "bundle",
|
|
182
|
+
bundle: true,
|
|
183
|
+
},
|
|
184
|
+
version,
|
|
185
|
+
banner,
|
|
186
|
+
minBanner,
|
|
187
|
+
dir,
|
|
188
|
+
bundle: true,
|
|
189
|
+
additionalExternals,
|
|
190
|
+
}),
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
return base;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const loadParticlesBundle = (p) => createParticlesBuild("bundle", p);
|
|
197
|
+
const loadParticlesPlugin = (p) => createParticlesBuild("plugin", p);
|
|
198
|
+
const loadParticlesEngine = (p) => createParticlesBuild("engine", p);
|
|
199
|
+
const loadParticlesEffect = (p) => createParticlesBuild("effect", p);
|
|
200
|
+
const loadParticlesInteraction = (p) => createParticlesBuild("interaction", p);
|
|
201
|
+
const loadParticlesInteractionExternal = (p) => createParticlesBuild("interactionExternal", p);
|
|
202
|
+
const loadParticlesInteractionParticles = (p) => createParticlesBuild("interactionParticles", p);
|
|
203
|
+
const loadParticlesPalette = (p) => createParticlesBuild("palette", p);
|
|
204
|
+
const loadParticlesPath = (p) => createParticlesBuild("path", p);
|
|
205
|
+
const loadParticlesPluginEasing = (p) => createParticlesBuild("pluginEasing", p);
|
|
206
|
+
const loadParticlesPluginEmittersShape = (p) => createParticlesBuild("pluginEmittersShape", p);
|
|
207
|
+
const loadParticlesPluginExport = (p) => createParticlesBuild("pluginExport", p);
|
|
208
|
+
const loadParticlesPreset = (p) => createParticlesBuild("preset", p);
|
|
209
|
+
const loadParticlesShape = (p) => createParticlesBuild("shape", p);
|
|
210
|
+
const loadParticlesTemplate = (p) => createParticlesBuild("template", p);
|
|
211
|
+
const loadParticlesUpdater = (p) => createParticlesBuild("updater", p);
|
|
212
|
+
|
|
213
|
+
exports.createParticlesBuild = createParticlesBuild;
|
|
214
|
+
exports.loadParticlesBundle = loadParticlesBundle;
|
|
215
|
+
exports.loadParticlesEffect = loadParticlesEffect;
|
|
216
|
+
exports.loadParticlesEngine = loadParticlesEngine;
|
|
217
|
+
exports.loadParticlesInteraction = loadParticlesInteraction;
|
|
218
|
+
exports.loadParticlesInteractionExternal = loadParticlesInteractionExternal;
|
|
219
|
+
exports.loadParticlesInteractionParticles = loadParticlesInteractionParticles;
|
|
220
|
+
exports.loadParticlesPalette = loadParticlesPalette;
|
|
221
|
+
exports.loadParticlesPath = loadParticlesPath;
|
|
222
|
+
exports.loadParticlesPlugin = loadParticlesPlugin;
|
|
223
|
+
exports.loadParticlesPluginEasing = loadParticlesPluginEasing;
|
|
224
|
+
exports.loadParticlesPluginEmittersShape = loadParticlesPluginEmittersShape;
|
|
225
|
+
exports.loadParticlesPluginExport = loadParticlesPluginExport;
|
|
226
|
+
exports.loadParticlesPreset = loadParticlesPreset;
|
|
227
|
+
exports.loadParticlesShape = loadParticlesShape;
|
|
228
|
+
exports.loadParticlesTemplate = loadParticlesTemplate;
|
|
229
|
+
exports.loadParticlesUpdater = loadParticlesUpdater;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ParticlesBuildParams } from "./types";
|
|
2
|
+
export declare const loadParticlesBundle: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
3
|
+
export declare const loadParticlesPlugin: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
4
|
+
export declare const loadParticlesEngine: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
5
|
+
export declare const loadParticlesEffect: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
6
|
+
export declare const loadParticlesInteraction: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
7
|
+
export declare const loadParticlesInteractionExternal: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
8
|
+
export declare const loadParticlesInteractionParticles: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
9
|
+
export declare const loadParticlesPalette: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
10
|
+
export declare const loadParticlesPath: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
11
|
+
export declare const loadParticlesPluginEasing: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
12
|
+
export declare const loadParticlesPluginEmittersShape: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
13
|
+
export declare const loadParticlesPluginExport: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
14
|
+
export declare const loadParticlesPreset: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
15
|
+
export declare const loadParticlesShape: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
16
|
+
export declare const loadParticlesTemplate: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
17
|
+
export declare const loadParticlesUpdater: (p: ParticlesBuildParams) => import("rollup").RollupOptions[];
|
|
18
|
+
export { createParticlesBuild } from "./createParticlesBuild";
|
|
19
|
+
export type { ParticlesBuildType } from "./buildMap";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,mBAAmB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEpC,eAAO,MAAM,mBAAmB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEpC,eAAO,MAAM,mBAAmB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEpC,eAAO,MAAM,mBAAmB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEpC,eAAO,MAAM,wBAAwB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEzC,eAAO,MAAM,gCAAgC,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEjD,eAAO,MAAM,iCAAiC,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAElD,eAAO,MAAM,oBAAoB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAErC,eAAO,MAAM,iBAAiB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAElC,eAAO,MAAM,yBAAyB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAE1C,eAAO,MAAM,gCAAgC,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEjD,eAAO,MAAM,yBAAyB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAE1C,eAAO,MAAM,mBAAmB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEpC,eAAO,MAAM,kBAAkB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEnC,eAAO,MAAM,qBAAqB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAEtC,eAAO,MAAM,oBAAoB,GAAI,GAAG,oBAAoB,qCACxB,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import replace from '@rollup/plugin-replace';
|
|
3
|
+
import terser from '@rollup/plugin-terser';
|
|
4
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
5
|
+
|
|
6
|
+
const buildMap = {
|
|
7
|
+
bundle: {
|
|
8
|
+
format: "",
|
|
9
|
+
hasBundle: true,
|
|
10
|
+
banner: ({ version }) => `tsParticles v${version}`,
|
|
11
|
+
minBanner: ({ version, bundleName }) => `tsParticles ${bundleName ?? ""} v${version}`,
|
|
12
|
+
},
|
|
13
|
+
effect: {
|
|
14
|
+
format: "effect",
|
|
15
|
+
banner: ({ version }) => `Effect v${version}`,
|
|
16
|
+
minBanner: ({ version, effectName }) => `tsParticles ${effectName} Effect v${version}`,
|
|
17
|
+
},
|
|
18
|
+
engine: {
|
|
19
|
+
format: "engine",
|
|
20
|
+
banner: ({ version }) => `tsParticles Engine v${version}`,
|
|
21
|
+
minBanner: ({ version }) => `tsParticles Engine v${version}`,
|
|
22
|
+
},
|
|
23
|
+
interaction: {
|
|
24
|
+
format: "interaction",
|
|
25
|
+
banner: ({ version }) => `Interaction v${version}`,
|
|
26
|
+
minBanner: ({ version }) => `Interaction v${version}`,
|
|
27
|
+
},
|
|
28
|
+
interactionExternal: {
|
|
29
|
+
format: "interaction.external",
|
|
30
|
+
banner: ({ version }) => `External Interaction v${version}`,
|
|
31
|
+
minBanner: ({ version }) => `External Interaction v${version}`,
|
|
32
|
+
},
|
|
33
|
+
interactionParticles: {
|
|
34
|
+
format: "interaction.particles",
|
|
35
|
+
banner: ({ version }) => `Particles Interaction v${version}`,
|
|
36
|
+
minBanner: ({ version }) => `Particles Interaction v${version}`,
|
|
37
|
+
},
|
|
38
|
+
palette: {
|
|
39
|
+
format: "palette",
|
|
40
|
+
banner: ({ version }) => `Palette v${version}`,
|
|
41
|
+
minBanner: ({ version }) => `Palette v${version}`,
|
|
42
|
+
},
|
|
43
|
+
path: {
|
|
44
|
+
format: "path",
|
|
45
|
+
banner: ({ version }) => `Path v${version}`,
|
|
46
|
+
minBanner: ({ version }) => `Path v${version}`,
|
|
47
|
+
},
|
|
48
|
+
plugin: {
|
|
49
|
+
format: "plugin",
|
|
50
|
+
banner: ({ version }) => `Plugin v${version}`,
|
|
51
|
+
minBanner: ({ version, pluginName }) => `tsParticles ${pluginName} Plugin v${version}`,
|
|
52
|
+
},
|
|
53
|
+
pluginEasing: {
|
|
54
|
+
format: "plugin.easing",
|
|
55
|
+
banner: ({ version }) => `Easing Plugin v${version}`,
|
|
56
|
+
minBanner: ({ version }) => `Easing Plugin v${version}`,
|
|
57
|
+
},
|
|
58
|
+
pluginEmittersShape: {
|
|
59
|
+
format: "plugin.emitters.shape",
|
|
60
|
+
banner: ({ version }) => `Emitters Shape v${version}`,
|
|
61
|
+
minBanner: ({ version }) => `Emitters Shape v${version}`,
|
|
62
|
+
},
|
|
63
|
+
pluginExport: {
|
|
64
|
+
format: "plugin.export",
|
|
65
|
+
banner: ({ version }) => `Export Plugin v${version}`,
|
|
66
|
+
minBanner: ({ version }) => `Export Plugin v${version}`,
|
|
67
|
+
},
|
|
68
|
+
preset: {
|
|
69
|
+
format: "preset",
|
|
70
|
+
hasBundle: true,
|
|
71
|
+
banner: ({ version }) => `Preset v${version}`,
|
|
72
|
+
minBanner: ({ version }) => `Preset v${version}`,
|
|
73
|
+
},
|
|
74
|
+
shape: {
|
|
75
|
+
format: "shape",
|
|
76
|
+
banner: ({ version }) => `Shape v${version}`,
|
|
77
|
+
minBanner: ({ version }) => `Shape v${version}`,
|
|
78
|
+
},
|
|
79
|
+
template: {
|
|
80
|
+
format: "template",
|
|
81
|
+
banner: ({ version }) => `Template v${version}`,
|
|
82
|
+
minBanner: ({ version }) => `Template v${version}`,
|
|
83
|
+
},
|
|
84
|
+
updater: {
|
|
85
|
+
format: "updater",
|
|
86
|
+
banner: ({ version }) => `Updater v${version}`,
|
|
87
|
+
minBanner: ({ version }) => `Updater v${version}`,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const getEntry = (data) => {
|
|
92
|
+
const { bundle, format, lazy, min, name } = data, fileName = bundle ? "bundle" : "index", completeFileName = lazy ? `${fileName}.lazy` : fileName, fixFormat = format ? `.${format}` : "", fixName = name ? `.${name}` : "", fixMin = min ? ".min" : "", fixLazy = lazy ? ".lazy" : "";
|
|
93
|
+
return {
|
|
94
|
+
name: `tsparticles${fixFormat}${fixName}${fixLazy}${fixMin}`,
|
|
95
|
+
input: `./dist/browser/${completeFileName}.js`,
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const getExternal = ({ bundle, additionalExternals = [] }) => {
|
|
100
|
+
if (bundle) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
return [
|
|
104
|
+
...additionalExternals.map(e => e.name),
|
|
105
|
+
/^tsparticles$/,
|
|
106
|
+
/^tsparticles-/,
|
|
107
|
+
/^@tsparticles\//,
|
|
108
|
+
];
|
|
109
|
+
};
|
|
110
|
+
const getGlobals = (additionalExternals = [], bundle) => {
|
|
111
|
+
if (bundle) {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
return Object.fromEntries(additionalExternals.map(e => [e.name, "window"]));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const createSingleConfig = (params, min, lazy) => {
|
|
118
|
+
const { additionalExternals, banner, bundle, dir, entry, minBanner, version, } = params, { name, input } = getEntry({ ...entry, min, lazy });
|
|
119
|
+
return {
|
|
120
|
+
input,
|
|
121
|
+
external: getExternal({ bundle, additionalExternals }),
|
|
122
|
+
plugins: [
|
|
123
|
+
replace({
|
|
124
|
+
preventAssignment: true,
|
|
125
|
+
__VERSION__: JSON.stringify(version),
|
|
126
|
+
}),
|
|
127
|
+
!min &&
|
|
128
|
+
visualizer({
|
|
129
|
+
filename: path.resolve(dir, "dist/report.html"),
|
|
130
|
+
}),
|
|
131
|
+
min && terser(),
|
|
132
|
+
].filter(Boolean),
|
|
133
|
+
output: {
|
|
134
|
+
file: path.resolve(dir, "dist", `${name}.js`),
|
|
135
|
+
format: "umd",
|
|
136
|
+
name: "tsParticles",
|
|
137
|
+
globals: getGlobals(additionalExternals, bundle),
|
|
138
|
+
banner: min ? minBanner : banner,
|
|
139
|
+
inlineDynamicImports: true,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const createConfig = (params) => {
|
|
145
|
+
return [
|
|
146
|
+
createSingleConfig(params, false, false),
|
|
147
|
+
createSingleConfig(params, true, false),
|
|
148
|
+
createSingleConfig(params, false, true),
|
|
149
|
+
createSingleConfig(params, true, true),
|
|
150
|
+
];
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const createParticlesBuild = (type, params) => {
|
|
154
|
+
const def = buildMap[type];
|
|
155
|
+
if (!def) {
|
|
156
|
+
throw new Error(`Unknown build type: ${type}`);
|
|
157
|
+
}
|
|
158
|
+
const dir = params.dir, version = params.version, additionalExternals = params.additionalExternals, moduleName = params.moduleName, bundle = params.bundle, banner = def.banner(params), minBanner = def.minBanner(params), base = createConfig({
|
|
159
|
+
entry: {
|
|
160
|
+
format: def.format,
|
|
161
|
+
name: moduleName,
|
|
162
|
+
bundle: false,
|
|
163
|
+
},
|
|
164
|
+
version,
|
|
165
|
+
banner,
|
|
166
|
+
minBanner,
|
|
167
|
+
dir,
|
|
168
|
+
bundle: false,
|
|
169
|
+
additionalExternals,
|
|
170
|
+
});
|
|
171
|
+
if (def.hasBundle && (bundle ?? true)) {
|
|
172
|
+
return [
|
|
173
|
+
...base,
|
|
174
|
+
...createConfig({
|
|
175
|
+
entry: {
|
|
176
|
+
format: def.format,
|
|
177
|
+
name: moduleName
|
|
178
|
+
? `${moduleName}.bundle`
|
|
179
|
+
: "bundle",
|
|
180
|
+
bundle: true,
|
|
181
|
+
},
|
|
182
|
+
version,
|
|
183
|
+
banner,
|
|
184
|
+
minBanner,
|
|
185
|
+
dir,
|
|
186
|
+
bundle: true,
|
|
187
|
+
additionalExternals,
|
|
188
|
+
}),
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
return base;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const loadParticlesBundle = (p) => createParticlesBuild("bundle", p);
|
|
195
|
+
const loadParticlesPlugin = (p) => createParticlesBuild("plugin", p);
|
|
196
|
+
const loadParticlesEngine = (p) => createParticlesBuild("engine", p);
|
|
197
|
+
const loadParticlesEffect = (p) => createParticlesBuild("effect", p);
|
|
198
|
+
const loadParticlesInteraction = (p) => createParticlesBuild("interaction", p);
|
|
199
|
+
const loadParticlesInteractionExternal = (p) => createParticlesBuild("interactionExternal", p);
|
|
200
|
+
const loadParticlesInteractionParticles = (p) => createParticlesBuild("interactionParticles", p);
|
|
201
|
+
const loadParticlesPalette = (p) => createParticlesBuild("palette", p);
|
|
202
|
+
const loadParticlesPath = (p) => createParticlesBuild("path", p);
|
|
203
|
+
const loadParticlesPluginEasing = (p) => createParticlesBuild("pluginEasing", p);
|
|
204
|
+
const loadParticlesPluginEmittersShape = (p) => createParticlesBuild("pluginEmittersShape", p);
|
|
205
|
+
const loadParticlesPluginExport = (p) => createParticlesBuild("pluginExport", p);
|
|
206
|
+
const loadParticlesPreset = (p) => createParticlesBuild("preset", p);
|
|
207
|
+
const loadParticlesShape = (p) => createParticlesBuild("shape", p);
|
|
208
|
+
const loadParticlesTemplate = (p) => createParticlesBuild("template", p);
|
|
209
|
+
const loadParticlesUpdater = (p) => createParticlesBuild("updater", p);
|
|
210
|
+
|
|
211
|
+
export { createParticlesBuild, loadParticlesBundle, loadParticlesEffect, loadParticlesEngine, loadParticlesInteraction, loadParticlesInteractionExternal, loadParticlesInteractionParticles, loadParticlesPalette, loadParticlesPath, loadParticlesPlugin, loadParticlesPluginEasing, loadParticlesPluginEmittersShape, loadParticlesPluginExport, loadParticlesPreset, loadParticlesShape, loadParticlesTemplate, loadParticlesUpdater };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ExternalData {
|
|
2
|
+
bundle: boolean;
|
|
3
|
+
data: Record<string, unknown>;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ConfigParams {
|
|
7
|
+
additionalExternals?: ExternalData[];
|
|
8
|
+
banner: string;
|
|
9
|
+
bundle?: boolean;
|
|
10
|
+
dir: string;
|
|
11
|
+
entry: {
|
|
12
|
+
bundle: boolean;
|
|
13
|
+
format: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
};
|
|
16
|
+
minBanner: string;
|
|
17
|
+
version: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ParticlesBuildParams {
|
|
20
|
+
dir: string;
|
|
21
|
+
version: string;
|
|
22
|
+
additionalExternals?: ExternalData[];
|
|
23
|
+
moduleName?: string;
|
|
24
|
+
bundle?: boolean;
|
|
25
|
+
bundleName?: string;
|
|
26
|
+
effectName?: string;
|
|
27
|
+
pluginName?: string;
|
|
28
|
+
presetName?: string;
|
|
29
|
+
shapeName?: string;
|
|
30
|
+
templateName?: string;
|
|
31
|
+
updaterName?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE;QACL,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsparticles/rollup-plugin",
|
|
3
|
+
"version": "3.4.14",
|
|
4
|
+
"description": "Rollup build utilities for tsParticles",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"rollup": "^4"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
27
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
28
|
+
"rollup-plugin-visualizer": "^7.0.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
32
|
+
"@types/node": "^25.6.0",
|
|
33
|
+
"typescript": "^6.0.3",
|
|
34
|
+
"rimraf": "^6.1.3"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "rimraf dist",
|
|
38
|
+
"build": "pnpm clean && rollup -c rollup.config.mjs",
|
|
39
|
+
"watch": "rollup -c rollup.config.mjs -w"
|
|
40
|
+
}
|
|
41
|
+
}
|