@tsparticles/cli 2.2.3 → 2.3.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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -14,7 +37,7 @@ async function bundle(basePath) {
14
37
  console.log("Bundling started");
15
38
  let res = false;
16
39
  try {
17
- const options = (await import(path_1.default.join(basePath, "webpack.config.js")));
40
+ const options = (await Promise.resolve(`${path_1.default.join(basePath, "webpack.config.js")}`).then(s => __importStar(require(s))));
18
41
  res = await new Promise((resolve, reject) => {
19
42
  (0, webpack_1.default)(options.default, (err, stats) => {
20
43
  if (err) {
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -15,7 +38,7 @@ async function buildDistFiles(basePath) {
15
38
  console.log("Build - started on dist files");
16
39
  let res;
17
40
  try {
18
- const pkgInfo = (await import(path_1.default.join(basePath, "package.json"))), libPackage = path_1.default.join(basePath, "package.dist.json"), distPath = path_1.default.join(basePath, pkgInfo.publishConfig?.directory ?? "dist");
41
+ const pkgInfo = (await Promise.resolve(`${path_1.default.join(basePath, "package.json")}`).then(s => __importStar(require(s)))), libPackage = path_1.default.join(basePath, "package.dist.json"), distPath = path_1.default.join(basePath, pkgInfo.publishConfig?.directory ?? "dist");
19
42
  const data = await fs_extra_1.default.readFile(libPackage), text = data.toString(), libObj = JSON.parse(text);
20
43
  libObj.version = pkgInfo.version;
21
44
  if (pkgInfo.dependencies) {
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -20,7 +43,7 @@ async function getFolderStats(folderPath, bundlePath) {
20
43
  if (!(await fs_extra_1.default.pathExists(folderPath))) {
21
44
  return stats;
22
45
  }
23
- const dir = await fs_extra_1.default.promises.opendir(folderPath), path = await import("path");
46
+ const dir = await fs_extra_1.default.promises.opendir(folderPath), path = await Promise.resolve().then(() => __importStar(require("path")));
24
47
  for await (const dirent of dir) {
25
48
  const increment = 1;
26
49
  if (dirent.isDirectory()) {
@@ -46,8 +69,8 @@ async function getFolderStats(folderPath, bundlePath) {
46
69
  * @returns the stats for the dist folder
47
70
  */
48
71
  async function getDistStats(basePath) {
49
- const path = await import("path"), distFolder = path.join(basePath, "dist"), pkgInfo = (await fs_extra_1.default.exists(path.join(distFolder, "package.json")))
50
- ? (await import(path.join(distFolder, "package.json")))
72
+ const path = await Promise.resolve().then(() => __importStar(require("path"))), distFolder = path.join(basePath, "dist"), pkgInfo = (await fs_extra_1.default.exists(path.join(distFolder, "package.json")))
73
+ ? (await Promise.resolve(`${path.join(distFolder, "package.json")}`).then(s => __importStar(require(s))))
51
74
  : {}, bundlePath = (await fs_extra_1.default.exists(distFolder)) && pkgInfo.jsdelivr
52
75
  ? path.resolve(path.join(distFolder, pkgInfo.jsdelivr))
53
76
  : undefined;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -101,7 +124,7 @@ async function compile(basePath, type) {
101
124
  if (!options) {
102
125
  return 3 /* ExitCodes.NoOptions */;
103
126
  }
104
- const ts = await import("typescript"), parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
127
+ const ts = await Promise.resolve().then(() => __importStar(require("typescript"))), parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
105
128
  if (!parsed) {
106
129
  return 4 /* ExitCodes.ParseError */;
107
130
  }
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.buildCommand = void 0;
4
27
  const commander_1 = require("commander");
@@ -17,44 +40,44 @@ buildCommand.option("-t, --tsc", "Build the library using TypeScript", false);
17
40
  buildCommand.argument("[path]", `Path to the project root folder, default is "src"`, "src");
18
41
  buildCommand.action(async (argPath) => {
19
42
  const opts = buildCommand.opts(), ci = !!opts.ci, all = !!opts.all || (!opts.bundle && !opts.clean && !opts.dist && !opts.lint && !opts.prettify && !opts.tsc), doBundle = all || !!opts.bundle, circularDeps = all || !!opts.circularDeps, clean = all || !!opts.clean, distfiles = all || !!opts.dist, doLint = all || !!opts.lint, prettier = all || !!opts.prettify, tsc = all || !!opts.tsc;
20
- const basePath = process.cwd(), { getDistStats } = await import("./build-diststats.js"), oldStats = await getDistStats(basePath);
43
+ const basePath = process.cwd(), { getDistStats } = await Promise.resolve().then(() => __importStar(require("./build-diststats.js"))), oldStats = await getDistStats(basePath);
21
44
  if (clean) {
22
- const { clearDist } = await import("./build-clear.js");
45
+ const { clearDist } = await Promise.resolve().then(() => __importStar(require("./build-clear.js")));
23
46
  await clearDist(basePath);
24
47
  }
25
- const path = await import("path"), srcPath = path.join(basePath, argPath), fs = await import("fs-extra");
48
+ const path = await Promise.resolve().then(() => __importStar(require("path"))), srcPath = path.join(basePath, argPath), fs = await Promise.resolve().then(() => __importStar(require("fs-extra")));
26
49
  if (!(await fs.pathExists(srcPath))) {
27
50
  throw new Error("Provided path does not exist");
28
51
  }
29
52
  let canContinue = true;
30
53
  if (canContinue && prettier) {
31
- const { prettifySrc } = await import("./build-prettier.js");
54
+ const { prettifySrc } = await Promise.resolve().then(() => __importStar(require("./build-prettier.js")));
32
55
  canContinue = await prettifySrc(basePath, srcPath, ci);
33
56
  }
34
57
  if (canContinue && doLint) {
35
- const { lint } = await import("./build-eslint.js");
58
+ const { lint } = await Promise.resolve().then(() => __importStar(require("./build-eslint.js")));
36
59
  canContinue = await lint(ci);
37
60
  }
38
61
  if (canContinue && tsc) {
39
- const { buildTS } = await import("./build-tsc.js");
62
+ const { buildTS } = await Promise.resolve().then(() => __importStar(require("./build-tsc.js")));
40
63
  canContinue = await buildTS(basePath);
41
64
  }
42
65
  if (canContinue && circularDeps) {
43
- const { buildCircularDeps } = await import("./build-circular-deps.js");
66
+ const { buildCircularDeps } = await Promise.resolve().then(() => __importStar(require("./build-circular-deps.js")));
44
67
  canContinue = await buildCircularDeps(basePath);
45
68
  }
46
69
  if (canContinue && doBundle) {
47
- const { bundle } = await import("./build-bundle.js");
70
+ const { bundle } = await Promise.resolve().then(() => __importStar(require("./build-bundle.js")));
48
71
  canContinue = await bundle(basePath);
49
72
  }
50
73
  if (canContinue && prettier) {
51
- const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await import("./build-prettier.js");
74
+ const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await Promise.resolve().then(() => __importStar(require("./build-prettier.js")));
52
75
  canContinue = await prettifyReadme(basePath, ci);
53
76
  canContinue = await prettifyPackageJson(basePath, ci);
54
77
  canContinue = await prettifyPackageDistJson(basePath, ci);
55
78
  }
56
79
  if (canContinue && distfiles) {
57
- const { buildDistFiles } = await import("./build-distfiles.js");
80
+ const { buildDistFiles } = await Promise.resolve().then(() => __importStar(require("./build-distfiles.js")));
58
81
  canContinue = await buildDistFiles(basePath);
59
82
  }
60
83
  if (!canContinue) {
@@ -5,7 +5,7 @@ import type { Engine } from "@tsparticles/engine";
5
5
  * @param engine - the engine instance to load the preset into
6
6
  */
7
7
  export async function loadTemplatePreset(engine: Engine): Promise<void> {
8
- const { options } = await import("./options");
8
+ const { options } = await import("./options.js");
9
9
 
10
10
  // TODO: additional modules must be loaded here
11
11
 
@@ -1,7 +1,7 @@
1
1
  import type { IShapeDrawData, IShapeDrawer } from "@tsparticles/engine";
2
2
 
3
3
  export class ShapeDrawer implements IShapeDrawer {
4
- async draw(_data: IShapeDrawData): Promise<void> {
4
+ draw(_data: IShapeDrawData): void {
5
5
  // draw the particle using the context
6
6
  // which is already centered in the particle position
7
7
  // colors are already handled, just draw the shape
@@ -10,8 +10,5 @@ export class ShapeDrawer implements IShapeDrawer {
10
10
  // pixelRatio is the canvas ratio used by the tsParticles instance, you may need it for density-independent shapes
11
11
  // the parameters have an underscore prefix because they're not used in this example
12
12
  // the underscore prefix can be removed for used parameters, the unused ones can be removed too
13
-
14
- // remove this if there's already an await call
15
- await Promise.resolve();
16
13
  }
17
14
  }
@@ -4,7 +4,7 @@ import type { Engine } from "@tsparticles/engine";
4
4
  * @param engine - the engine instance to load the shape into
5
5
  */
6
6
  export async function loadTemplateShape(engine: Engine): Promise<void> {
7
- const { ShapeDrawer } = await import("./ShapeDrawer");
7
+ const { ShapeDrawer } = await import("./ShapeDrawer.js");
8
8
 
9
9
  await engine.addShape("#template#", new ShapeDrawer());
10
10
  }
@@ -72,6 +72,6 @@
72
72
  "module": "index.js",
73
73
  "types": "index.d.ts",
74
74
  "dependencies": {
75
- "@tsparticles/engine": "^3.0.3"
75
+ "@tsparticles/engine": "^3.3.0"
76
76
  }
77
77
  }
@@ -83,16 +83,16 @@
83
83
  "prettier": "@tsparticles/prettier-config",
84
84
  "devDependencies": {
85
85
  "@babel/core": "^7.23.9",
86
- "@tsparticles/cli": "^2.2.3",
87
- "@tsparticles/eslint-config": "^2.1.4",
88
- "@tsparticles/prettier-config": "^2.1.0",
89
- "@tsparticles/tsconfig": "^2.0.1",
90
- "@tsparticles/webpack-plugin": "^2.1.4",
86
+ "@tsparticles/cli": "^2.3.0",
87
+ "@tsparticles/eslint-config": "^2.2.0",
88
+ "@tsparticles/prettier-config": "^2.1.6",
89
+ "@tsparticles/tsconfig": "^2.1.7",
90
+ "@tsparticles/webpack-plugin": "^2.2.0",
91
91
  "@types/webpack-env": "^1.18.4",
92
- "@typescript-eslint/eslint-plugin": "^6.20.0",
93
- "@typescript-eslint/parser": "^6.20.0",
92
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
93
+ "@typescript-eslint/parser": "^7.1.0",
94
94
  "babel-loader": "^9.1.3",
95
- "browserslist": "^4.22.3",
95
+ "browserslist": "^4.23.0",
96
96
  "copyfiles": "^2.4.1",
97
97
  "eslint": "^8.56.0",
98
98
  "eslint-config-prettier": "^9.1.0",
@@ -105,6 +105,6 @@
105
105
  "webpack-cli": "^5.1.4"
106
106
  },
107
107
  "dependencies": {
108
- "@tsparticles/engine": "^3.2.0"
108
+ "@tsparticles/engine": "^3.3.0"
109
109
  }
110
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/cli",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "tsparticles-cli": "dist/cli.js"
@@ -10,10 +10,10 @@
10
10
  },
11
11
  "prettier": "@tsparticles/prettier-config",
12
12
  "dependencies": {
13
- "@tsparticles/eslint-config": "^2.1.4",
14
- "@tsparticles/prettier-config": "^2.1.0",
13
+ "@tsparticles/eslint-config": "^2.2.0",
14
+ "@tsparticles/prettier-config": "^2.1.6",
15
15
  "@tsparticles/tsconfig": "^2.1.7",
16
- "@tsparticles/webpack-plugin": "^2.1.6",
16
+ "@tsparticles/webpack-plugin": "^2.2.0",
17
17
  "@typescript-eslint/eslint-plugin": "^7.1.0",
18
18
  "@typescript-eslint/parser": "^7.1.0",
19
19
  "commander": "^12.0.0",
@@ -34,18 +34,31 @@
34
34
  "webpack": "^5.90.3"
35
35
  },
36
36
  "devDependencies": {
37
+ "@babel/core": "^7.23.9",
38
+ "@tsparticles/cli": "^2.2.4",
39
+ "@tsparticles/engine": "^3.3.0",
37
40
  "@types/chai": "^4.3.12",
41
+ "@types/eslint": "^8.56.5",
38
42
  "@types/fs-extra": "^11.0.4",
39
43
  "@types/klaw": "^3.0.6",
40
44
  "@types/madge": "^5.0.3",
41
45
  "@types/mocha": "^10.0.6",
42
- "@types/node": "^20.11.20",
46
+ "@types/node": "^20.11.24",
43
47
  "@types/prompts": "^2.4.9",
48
+ "@types/webpack-env": "^1.18.4",
49
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
50
+ "@typescript-eslint/parser": "^7.1.0",
51
+ "babel-loader": "^9.1.3",
52
+ "browserslist": "^4.23.0",
44
53
  "chai": "^4.4.1",
54
+ "copyfiles": "^2.4.1",
45
55
  "cross-env": "^7.0.3",
46
56
  "mocha": "^10.3.0",
47
57
  "nyc": "^15.1.0",
48
- "ts-node": "^10.9.2"
58
+ "terser-webpack-plugin": "^5.3.10",
59
+ "ts-node": "^10.9.2",
60
+ "webpack-bundle-analyzer": "^4.10.1",
61
+ "webpack-cli": "^5.1.4"
49
62
  },
50
63
  "description": "tsParticles CLI",
51
64
  "main": ".eslintrc.js",
package/src/tsconfig.json CHANGED
@@ -27,11 +27,11 @@
27
27
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
28
28
 
29
29
  /* Modules */
30
- "module": "Node16",
30
+ "module": "commonjs",
31
31
  /* Specify what module code is generated. */
32
32
  "rootDir": ".",
33
33
  /* Specify the root folder within your source files. */
34
- "moduleResolution": "Node16",
34
+ "moduleResolution": "node",
35
35
  /* Specify how TypeScript looks up a file from a given module specifier. */
36
36
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
37
37
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
package/tsconfig.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
- "compilerOptions": {
3
- "rootDir": ".",
4
- "outDir": ".",
5
- "resolveJsonModule": true,
6
- "composite": true
7
- },
8
- "files": ["package.json"]
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "outDir": ".",
5
+ "resolveJsonModule": true,
6
+ "composite": true,
7
+ "types": [
8
+ "node",
9
+ "chai",
10
+ "mocha",
11
+ "fs-extra",
12
+ "klaw",
13
+ "madge",
14
+ "prompts",
15
+ "eslint"
16
+ ]
17
+ },
18
+ "files": [
19
+ "package.json"
20
+ ]
9
21
  }