@prosopo/config 3.3.4 → 3.3.5

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 (80) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +27 -24
  2. package/.turbo/turbo-build$colon$tsc.log +4 -4
  3. package/.turbo/turbo-build.log +28 -24
  4. package/CHANGELOG.md +27 -0
  5. package/dist/_virtual/_rolldown/runtime.js +3 -0
  6. package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
  7. package/dist/cjs/dependencies.cjs +130 -137
  8. package/dist/cjs/index.cjs +31 -32
  9. package/dist/cjs/vite/TsNoCheckPlugin.cjs +11 -15
  10. package/dist/cjs/vite/index.cjs +26 -26
  11. package/dist/cjs/vite/vite-plugin-close-and-copy.cjs +42 -42
  12. package/dist/cjs/vite/vite-plugin-copy.cjs +39 -38
  13. package/dist/cjs/vite/vite-plugin-externalize-obfuscator-deadcode.cjs +25 -0
  14. package/dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs +16 -24
  15. package/dist/cjs/vite/vite-plugin-remove-unused-translations.cjs +53 -74
  16. package/dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs +12 -15
  17. package/dist/cjs/vite/vite.backend.config.cjs +87 -104
  18. package/dist/cjs/vite/vite.commonjs.config.cjs +69 -74
  19. package/dist/cjs/vite/vite.esm.config.cjs +71 -70
  20. package/dist/cjs/vite/vite.frontend.config.cjs +173 -210
  21. package/dist/cjs/vite/vite.test.config.cjs +70 -80
  22. package/dist/cjs/vite/vite.threads.test.config.cjs +67 -78
  23. package/dist/cjs/webpack/index.cjs +0 -2
  24. package/dist/cjs/webpack/webpack.config.cjs +108 -146
  25. package/dist/dependencies.d.ts.map +1 -1
  26. package/dist/dependencies.js +123 -138
  27. package/dist/dependencies.js.map +1 -1
  28. package/dist/index.js +14 -31
  29. package/dist/vite/TsNoCheckPlugin.js +12 -16
  30. package/dist/vite/index.d.ts +1 -0
  31. package/dist/vite/index.d.ts.map +1 -1
  32. package/dist/vite/index.js +13 -25
  33. package/dist/vite/index.js.map +1 -1
  34. package/dist/vite/vite-plugin-close-and-copy.js +37 -41
  35. package/dist/vite/vite-plugin-copy.js +32 -36
  36. package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.d.ts +3 -0
  37. package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.d.ts.map +1 -0
  38. package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.js +25 -0
  39. package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.js.map +1 -0
  40. package/dist/vite/vite-plugin-fix-absolute-imports.js +15 -24
  41. package/dist/vite/vite-plugin-remove-unused-translations.js +50 -76
  42. package/dist/vite/vite-plugin-sourcemap-exclude.js +12 -16
  43. package/dist/vite/vite.backend.config.d.ts.map +1 -1
  44. package/dist/vite/vite.backend.config.js +80 -101
  45. package/dist/vite/vite.backend.config.js.map +1 -1
  46. package/dist/vite/vite.commonjs.config.d.ts.map +1 -1
  47. package/dist/vite/vite.commonjs.config.js +61 -71
  48. package/dist/vite/vite.commonjs.config.js.map +1 -1
  49. package/dist/vite/vite.esm.config.d.ts.map +1 -1
  50. package/dist/vite/vite.esm.config.js +63 -67
  51. package/dist/vite/vite.esm.config.js.map +1 -1
  52. package/dist/vite/vite.frontend.config.d.ts.map +1 -1
  53. package/dist/vite/vite.frontend.config.js +158 -202
  54. package/dist/vite/vite.frontend.config.js.map +1 -1
  55. package/dist/vite/vite.test.config.d.ts.map +1 -1
  56. package/dist/vite/vite.test.config.js +63 -78
  57. package/dist/vite/vite.test.config.js.map +1 -1
  58. package/dist/vite/vite.threads.test.config.d.ts.map +1 -1
  59. package/dist/vite/vite.threads.test.config.js +61 -76
  60. package/dist/vite/vite.threads.test.config.js.map +1 -1
  61. package/dist/webpack/index.js +1 -1
  62. package/dist/webpack/webpack.config.d.ts +2 -0
  63. package/dist/webpack/webpack.config.d.ts.map +1 -1
  64. package/dist/webpack/webpack.config.js +96 -119
  65. package/dist/webpack/webpack.config.js.map +1 -1
  66. package/package.json +9 -9
  67. package/src/dependencies.ts +15 -2
  68. package/src/vite/index.ts +1 -0
  69. package/src/vite/vite-plugin-externalize-obfuscator-deadcode.ts +43 -0
  70. package/src/vite/vite.backend.config.ts +19 -2
  71. package/src/vite/vite.commonjs.config.ts +2 -0
  72. package/src/vite/vite.esm.config.ts +12 -0
  73. package/src/vite/vite.frontend.config.ts +19 -8
  74. package/src/vite/vite.test.config.ts +15 -10
  75. package/src/vite/vite.threads.test.config.ts +6 -9
  76. package/src/webpack/webpack.config.ts +8 -1
  77. package/tsconfig.tsbuildinfo +1 -1
  78. package/vite.cjs.config.ts +4 -0
  79. package/vite.esm.config.ts +9 -1
  80. package/.turbo/turbo-typecheck.log +0 -4
@@ -1,32 +1,35 @@
1
1
 
2
- > @prosopo/config@3.3.4 build:cjs
2
+ > @prosopo/config@3.3.5 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
6
6
  { tsConfigPaths: [] }
7
7
  { externals: [] }
8
- vite v6.4.1 building SSR bundle for production...
8
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
9
+ vite v8.1.5 building ssr environment for production...
9
10
  Bundle build started
10
- transforming...
11
- Build end
12
- ✓ 17 modules transformed.
13
- Entry module "src/vite/vite-plugin-remove-unused-translations.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
11
+ 
12
+ ✓ 19 modules transformed.
14
13
  rendering chunks...
15
- dist/cjs/webpack/index.cjs 0.05 kB
16
- dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs 0.47 kB
17
- dist/cjs/vite/TsNoCheckPlugin.cjs 0.58 kB
18
- dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs 0.68 kB
19
- dist/cjs/vite/vite-plugin-copy.cjs 1.31 kB
20
- dist/cjs/vite/vite-plugin-close-and-copy.cjs 1.39 kB
21
- dist/cjs/vite/index.cjs 1.62 kB
22
- dist/cjs/index.cjs 2.04 kB
23
- dist/cjs/vite/vite.esm.config.cjs 2.08 kB
24
- dist/cjs/vite/vite.commonjs.config.cjs 2.29 kB
25
- dist/cjs/vite/vite.threads.test.config.cjs 2.51 kB
26
- dist/cjs/vite/vite.test.config.cjs 2.54 kB
27
- dist/cjs/vite/vite-plugin-remove-unused-translations.cjs 2.60 kB
28
- dist/cjs/vite/vite.backend.config.cjs 3.57 kB
29
- dist/cjs/webpack/webpack.config.cjs 5.05 kB
30
- dist/cjs/dependencies.cjs 5.22 kB
31
- dist/cjs/vite/vite.frontend.config.cjs 7.82 kB
32
- ✓ built in 205ms
14
+ computing gzip size...
15
+ dist/cjs/webpack/index.cjs 0.00 kB │ gzip: 0.02 kB
16
+ dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs 0.34 kB │ gzip: 0.23 kB
17
+ dist/cjs/vite/TsNoCheckPlugin.cjs 0.37 kB │ gzip: 0.24 kB
18
+ dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs 0.60 kB │ gzip: 0.34 kB
19
+ dist/cjs/vite/vite-plugin-externalize-obfuscator-deadcode.cjs 0.68 kB │ gzip: 0.37 kB
20
+ dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
21
+ dist/cjs/vite/vite-plugin-copy.cjs 1.60 kB │ gzip: 0.65 kB
22
+ dist/cjs/vite/vite-plugin-close-and-copy.cjs 1.77 kB │ gzip: 0.67 kB
23
+ dist/cjs/vite/index.cjs 2.07 kB │ gzip: 0.46 kB
24
+ dist/cjs/vite/vite-plugin-remove-unused-translations.cjs 2.34 kB │ gzip: 1.01 kB
25
+ dist/cjs/vite/vite.esm.config.cjs 2.39 kB │ gzip: 0.92 kB
26
+ dist/cjs/vite/vite.commonjs.config.cjs 2.52 kB │ gzip: 0.99 kB
27
+ dist/cjs/vite/vite.threads.test.config.cjs 2.52 kB │ gzip: 1.00 kB
28
+ dist/cjs/index.cjs 2.54 kB │ gzip: 0.57 kB
29
+ dist/cjs/vite/vite.test.config.cjs 2.67 kB │ gzip: 1.03 kB
30
+ dist/cjs/vite/vite.backend.config.cjs 3.63 kB │ gzip: 1.35 kB
31
+ dist/cjs/webpack/webpack.config.cjs 3.72 kB │ gzip: 1.30 kB
32
+ dist/cjs/dependencies.cjs 5.87 kB │ gzip: 1.92 kB
33
+ dist/cjs/vite/vite.frontend.config.cjs 6.66 kB │ gzip: 2.32 kB
34
+
35
+ ✓ built in 59ms
@@ -1,11 +1,11 @@
1
1
 
2
- > @prosopo/config@3.3.4 build:tsc
2
+ > @prosopo/config@3.3.5 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 3:24:01 PM - Projects in this build:
5
+ 8:58:29 PM - Projects in this build:
6
6
  * tsconfig.json
7
7
 
8
- 3:24:01 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
8
+ 8:58:29 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
9
9
 
10
- 3:24:01 PM - Building project '/home/runner/work/captcha/captcha/dev/config/tsconfig.json'...
10
+ 8:58:29 PM - Building project '/home/runner/work/captcha/captcha/dev/config/tsconfig.json'...
11
11
 
@@ -1,35 +1,39 @@
1
1
 
2
- > @prosopo/config@3.3.4 build
2
+ > @prosopo/config@3.3.5 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/config@3.3.4 build:cross-env
6
+ > @prosopo/config@3.3.5 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
10
10
  { tsConfigPaths: [] }
11
11
  { externals: [] }
12
- vite v6.4.1 building SSR bundle for production...
12
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
13
+ vite v8.1.5 building ssr environment for production...
13
14
  Bundle build started
14
- transforming...
15
- Build end
16
- ✓ 17 modules transformed.
15
+ 
16
+ ✓ 19 modules transformed.
17
17
  rendering chunks...
18
- dist/webpack/index.js 0.03 kB
19
- dist/vite/vite-plugin-sourcemap-exclude.js 0.46 kB
20
- dist/vite/TsNoCheckPlugin.js 0.48 kB
21
- dist/vite/vite-plugin-fix-absolute-imports.js 0.66 kB
22
- dist/vite/index.js 1.24 kB
23
- dist/vite/vite-plugin-copy.js 1.29 kB
24
- dist/vite/vite-plugin-close-and-copy.js 1.38 kB
25
- dist/index.js 1.56 kB
26
- dist/vite/vite.esm.config.js 2.02 kB
27
- dist/vite/vite.commonjs.config.js 2.21 kB
28
- dist/vite/vite-plugin-remove-unused-translations.js 2.43 kB
29
- dist/vite/vite.threads.test.config.js 2.48 kB
30
- dist/vite/vite.test.config.js 2.51 kB
31
- dist/vite/vite.backend.config.js 3.49 kB
32
- dist/webpack/webpack.config.js 3.81 kB
33
- dist/dependencies.js 5.02 kB
34
- dist/vite/vite.frontend.config.js 7.66 kB
35
- ✓ built in 241ms
18
+ computing gzip size...
19
+ dist/webpack/index.js 0.01 kB │ gzip: 0.03 kB
20
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
21
+ dist/vite/vite-plugin-sourcemap-exclude.js 0.34 kB │ gzip: 0.23 kB
22
+ dist/vite/TsNoCheckPlugin.js 0.36 kB │ gzip: 0.23 kB
23
+ dist/vite/vite-plugin-fix-absolute-imports.js 0.59 kB │ gzip: 0.33 kB
24
+ dist/vite/vite-plugin-externalize-obfuscator-deadcode.js 0.69 kB │ gzip: 0.38 kB
25
+ dist/vite/vite-plugin-copy.js 1.22 kB │ gzip: 0.57 kB
26
+ dist/vite/vite-plugin-close-and-copy.js 1.46 kB │ gzip: 0.61 kB
27
+ dist/vite/index.js 1.47 kB │ gzip: 0.40 kB
28
+ dist/index.js 1.77 kB │ gzip: 0.48 kB
29
+ dist/vite/vite.esm.config.js 1.90 kB │ gzip: 0.84 kB
30
+ dist/vite/vite.commonjs.config.js 2.00 kB │ gzip: 0.90 kB
31
+ dist/vite/vite-plugin-remove-unused-translations.js 2.03 kB │ gzip: 0.92 kB
32
+ dist/vite/vite.threads.test.config.js 2.19 kB │ gzip: 0.94 kB
33
+ dist/vite/vite.test.config.js 2.24 kB │ gzip: 0.95 kB
34
+ dist/webpack/webpack.config.js 3.08 kB │ gzip: 1.23 kB
35
+ dist/vite/vite.backend.config.js 3.10 kB │ gzip: 1.27 kB
36
+ dist/dependencies.js 5.31 kB │ gzip: 1.81 kB
37
+ dist/vite/vite.frontend.config.js 5.68 kB │ gzip: 2.19 kB
38
+
39
+ ✓ built in 49ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @prosopo/config
2
2
 
3
+ ## 3.3.5
4
+ ### Patch Changes
5
+
6
+ - 0e1171c: chore(deps): combined dependabot bumps (lodash, webpack-dev-server, sharp, i18next-http-middleware, actions/setup-node and transitive security updates)
7
+ - cb1b0b2: Honour /*#__PURE__*/ annotations when tree-shaking. Rolldown has no
8
+ `treeshake.preset`, so Rollup's "smallest" could not be carried across in the
9
+ Vite 8 upgrade; ignoring pure annotations retained dead library code that every
10
+ consumer shipped. Cuts ~17KB gzip off the procaptcha widget bundle with a
11
+ byte-identical detector bundle.
12
+ - 9fba3d3: Build workspace declarations before running tests. `turbo run test` depended only on `@prosopo/config#build`, so a package's dependencies were present in `dist` as bundled JavaScript with no `.d.ts`. Type checking then fell back to the compiled JS, which reports types as values and floods the run with implicit-any errors from other packages' output.
13
+ - e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
14
+ - 89effc8: test(workspace): unit + type tests, fix root-path encoding, stale getters and coverage for non-`packages/` workspaces
15
+
16
+ - `getRootDir` used `new URL(...).pathname`, which is percent-encoded — a
17
+ checkout under a path containing a space or a `#` produced `%20`/`%23` and
18
+ every derived path failed to resolve. Now uses `fileURLToPath`.
19
+ - `getClientExampleDir` and `getDappExampleDir` returned paths for
20
+ `demos/client-example` and `demos/dapp-example`, neither of which exists any
21
+ more. Both were unused; removed.
22
+ - `findWorkspaceRoot` takes an optional injected dependency set so the search
23
+ can be tested against a synthetic tree, and no longer parses package.json
24
+ into an implicitly-`any` value.
25
+ - `ViteTestConfig` decided whether it was running inside a package by looking
26
+ for `/packages/` in the cwd, so workspaces under `dev/`, `demos/` and
27
+ `integration/` fell through to the repo-root globs and reported 0/0 coverage
28
+ regardless of what their tests covered.
29
+
3
30
  ## 3.3.4
4
31
  ### Patch Changes
5
32
 
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -1,152 +1,145 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const child_process = require("node:child_process");
4
- const fs = require("node:fs");
5
- const path = require("node:path");
6
- const util = require("node:util");
7
- const exec = util.promisify(child_process.exec);
8
- const peerDepsRegex = /UNMET\sOPTIONAL\sDEPENDENCY\s+(@*[\w\-/.]+)@/;
9
- const depsRegex = /\s+(@*[\w\-/.]+)@/;
10
- const getTsconfigDir = (tsConfigPath) => ".json" === path.extname(tsConfigPath) ? path.dirname(tsConfigPath) : tsConfigPath;
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ let node_fs = require("node:fs");
3
+ node_fs = require_runtime.__toESM(node_fs, 1);
4
+ let node_path = require("node:path");
5
+ node_path = require_runtime.__toESM(node_path, 1);
6
+ let node_child_process = require("node:child_process");
7
+ node_child_process = require_runtime.__toESM(node_child_process, 1);
8
+ let node_util = require("node:util");
9
+ node_util = require_runtime.__toESM(node_util, 1);
10
+ //#region src/dependencies.ts
11
+ var exec = node_util.default.promisify(node_child_process.default.exec);
12
+ var peerDepsRegex = /UNMET\sOPTIONAL\sDEPENDENCY\s+(@*[\w\-/.]+)@/;
13
+ var depsRegex = /\s+(@*[\w\-/.]+)@/;
14
+ var getTsconfigDir = (tsConfigPath) => ".json" === node_path.default.extname(tsConfigPath) ? node_path.default.dirname(tsConfigPath) : tsConfigPath;
11
15
  async function getPackageDir(packageName) {
12
- let pkg = packageName;
13
- if (packageName && !packageName.startsWith("@prosopo/")) {
14
- pkg = `@prosopo/${packageName}`;
15
- }
16
- const pkgCommand = `npm list ${pkg} -ap`;
17
- console.info(`Running command ${pkgCommand}`);
18
- const { stdout: packageDir, stderr } = await exec(pkgCommand);
19
- if (stderr) {
20
- if (stderr.includes("ERR!")) {
21
- throw new Error("CONFIG.INVALID_PACKAGE_DIR");
22
- }
23
- }
24
- return packageDir.trim() || path.resolve();
16
+ let pkg = packageName;
17
+ if (packageName && !packageName.startsWith("@prosopo/")) pkg = `@prosopo/${packageName}`;
18
+ const pkgCommand = `npm list ${pkg} -ap`;
19
+ console.info(`Running command ${pkgCommand}`);
20
+ const { stdout: packageDir, stderr } = await exec(pkgCommand);
21
+ if (stderr) {
22
+ if (stderr.includes("ERR!")) throw new Error("CONFIG.INVALID_PACKAGE_DIR");
23
+ }
24
+ return packageDir.trim() || node_path.default.resolve();
25
25
  }
26
+ /**
27
+ * Resolve the tsconfig path for a reference using the initial tsconfig path and the reference path. If the reference
28
+ * does not contain a tsconfig filename, `tsconfig.json` will be appended to the path.
29
+ * @param initialTsConfigPath
30
+ * @param reference
31
+ */
26
32
  function getReferenceTsConfigPath(initialTsConfigPath, reference) {
27
- let refTSConfigPath = path.resolve(
28
- getTsconfigDir(initialTsConfigPath),
29
- reference.path
30
- );
31
- if (!refTSConfigPath.endsWith(".json")) {
32
- refTSConfigPath = path.resolve(refTSConfigPath, "tsconfig.json");
33
- }
34
- return refTSConfigPath;
33
+ let refTSConfigPath = node_path.default.resolve(getTsconfigDir(initialTsConfigPath), reference.path);
34
+ if (!refTSConfigPath.endsWith(".json")) refTSConfigPath = node_path.default.resolve(refTSConfigPath, "tsconfig.json");
35
+ return refTSConfigPath;
35
36
  }
37
+ /**
38
+ * Get the tsconfig paths for a package
39
+ * @param tsConfigPath the tsconfig path to start with
40
+ * @param ignorePatterns the patterns to ignore
41
+ * @param tsConfigPaths the tsconfig paths to add to
42
+ * @param includeInitialTsConfig return the initial tsconfig path in the returned array
43
+ */
36
44
  function getTsConfigs(tsConfigPath, ignorePatterns = [], tsConfigPaths = [], includeInitialTsConfig = true) {
37
- let tsConfigs = [...tsConfigPaths];
38
- const references = JSON.parse(
39
- fs.readFileSync(tsConfigPath).toString()
40
- ).references;
41
- if (!tsConfigs.includes(tsConfigPath)) {
42
- if (references) {
43
- const ignore = ignorePatterns && ignorePatterns.length > 0 ? new RegExp(`${ignorePatterns.join("|")}`) : void 0;
44
- if (includeInitialTsConfig) {
45
- tsConfigs.push(tsConfigPath);
46
- }
47
- const filteredReferences = references.filter(
48
- (reference) => ignore ? !ignore.test(reference.path) : false
49
- );
50
- for (const reference of filteredReferences) {
51
- const refTSConfigPath = getReferenceTsConfigPath(
52
- tsConfigPath,
53
- reference
54
- );
55
- const newTsConfigs = getTsConfigs(
56
- refTSConfigPath,
57
- ignorePatterns,
58
- tsConfigs
59
- );
60
- if (newTsConfigs.length > 0) {
61
- const distinctTsConfigPaths = new Set(tsConfigs.concat(newTsConfigs));
62
- tsConfigs = [...distinctTsConfigPaths];
63
- }
64
- }
65
- }
66
- }
67
- return tsConfigs;
45
+ let tsConfigs = [...tsConfigPaths];
46
+ const references = JSON.parse(node_fs.default.readFileSync(tsConfigPath).toString()).references;
47
+ if (!tsConfigs.includes(tsConfigPath)) {
48
+ if (references) {
49
+ const ignore = ignorePatterns && ignorePatterns.length > 0 ? new RegExp(`${ignorePatterns.join("|")}`) : void 0;
50
+ if (includeInitialTsConfig) tsConfigs.push(tsConfigPath);
51
+ const filteredReferences = references.filter((reference) => ignore ? !ignore.test(reference.path) : false);
52
+ for (const reference of filteredReferences) {
53
+ const newTsConfigs = getTsConfigs(getReferenceTsConfigPath(tsConfigPath, reference), ignorePatterns, tsConfigs);
54
+ if (newTsConfigs.length > 0) tsConfigs = [...new Set(tsConfigs.concat(newTsConfigs))];
55
+ }
56
+ }
57
+ }
58
+ return tsConfigs;
68
59
  }
60
+ /**
61
+ * Get the workspace externals for a package
62
+ * @param tsConfigPath
63
+ * @param ignorePatterns
64
+ */
69
65
  async function getExternalsFromReferences(tsConfigPath, ignorePatterns = []) {
70
- const tsConfigPaths = getTsConfigs(tsConfigPath, ignorePatterns, [], false);
71
- console.debug({ tsConfigPaths });
72
- const promises = [];
73
- for (const refTsConfigPath of tsConfigPaths) {
74
- const packageJsonPath = path.resolve(
75
- getTsconfigDir(refTsConfigPath),
76
- "package.json"
77
- );
78
- promises.push(
79
- new Promise((resolve, reject) => {
80
- fs.stat(packageJsonPath, (err) => {
81
- if (err) {
82
- reject(err);
83
- }
84
- fs.readFile(packageJsonPath, (err2, buffer) => {
85
- if (err2) {
86
- reject(err2);
87
- } else {
88
- const packageJson = JSON.parse(buffer.toString());
89
- const pkg = packageJson.name;
90
- resolve(pkg);
91
- }
92
- });
93
- });
94
- })
95
- );
96
- }
97
- const externals = await Promise.all(promises);
98
- console.debug({ externals });
99
- return externals;
66
+ const tsConfigPaths = getTsConfigs(tsConfigPath, ignorePatterns, [], false);
67
+ console.debug({ tsConfigPaths });
68
+ const promises = [];
69
+ for (const refTsConfigPath of tsConfigPaths) {
70
+ const packageJsonPath = node_path.default.resolve(getTsconfigDir(refTsConfigPath), "package.json");
71
+ promises.push(new Promise((resolve, reject) => {
72
+ node_fs.default.stat(packageJsonPath, (err) => {
73
+ if (err) reject(err);
74
+ node_fs.default.readFile(packageJsonPath, (err, buffer) => {
75
+ if (err) reject(err);
76
+ else {
77
+ const pkg = JSON.parse(buffer.toString()).name;
78
+ resolve(pkg);
79
+ }
80
+ });
81
+ });
82
+ }));
83
+ }
84
+ const externals = await Promise.all(promises);
85
+ console.debug({ externals });
86
+ return externals;
100
87
  }
88
+ /**
89
+ * Get the dependencies for a package
90
+ * @param packageName
91
+ * @param production
92
+ */
101
93
  async function getDependencies(packageName, production) {
102
- let cmd = production ? "npm ls -a --silent --omit=dev --package-lock-only" : "npm ls --silent -a --package-lock-only";
103
- if (packageName) {
104
- const packageDir = await getPackageDir(packageName);
105
- cmd = `cd ${packageDir.trim()} && ${cmd}`;
106
- console.info(`Running command ${cmd} in ${packageDir}`);
107
- }
108
- let concat = "";
109
- const { stdout, stderr } = await exec(cmd);
110
- concat = stdout + stderr;
111
- let deps = [];
112
- let peerDeps = [];
113
- for (const line of concat.split("\n")) {
114
- if (line.includes("UNMET OPTIONAL DEPENDENCY")) {
115
- const parts = line.match(peerDepsRegex);
116
- if (parts && parts.length > 1) {
117
- peerDeps.push(parts[1]);
118
- }
119
- } else {
120
- const parts = line.match(depsRegex);
121
- if (parts && parts.length > 1) {
122
- deps.push(parts[1]);
123
- }
124
- }
125
- }
126
- deps = [...new Set(deps)];
127
- peerDeps = [...new Set(peerDeps)];
128
- return {
129
- dependencies: deps.filter((x, i) => i === deps.indexOf(x)),
130
- optionalPeerDependencies: peerDeps.filter(
131
- (x, i) => i === peerDeps.indexOf(x)
132
- )
133
- };
94
+ let cmd = production ? "npm ls -a --silent --omit=dev --package-lock-only" : "npm ls --silent -a --package-lock-only";
95
+ if (packageName) {
96
+ const packageDir = await getPackageDir(packageName);
97
+ cmd = `cd ${packageDir.trim()} && ${cmd}`;
98
+ console.info(`Running command ${cmd} in ${packageDir}`);
99
+ }
100
+ let concat = "";
101
+ try {
102
+ const { stdout, stderr } = await exec(cmd);
103
+ concat = stdout + stderr;
104
+ } catch (error) {
105
+ const execError = error;
106
+ if (typeof execError.stdout === "string") concat = execError.stdout + (execError.stderr ?? "");
107
+ else throw error;
108
+ }
109
+ let deps = [];
110
+ let peerDeps = [];
111
+ for (const line of concat.split("\n")) if (line.includes("UNMET OPTIONAL DEPENDENCY")) {
112
+ const parts = line.match(peerDepsRegex);
113
+ if (parts && parts.length > 1) peerDeps.push(parts[1]);
114
+ } else {
115
+ const parts = line.match(depsRegex);
116
+ if (parts && parts.length > 1) deps.push(parts[1]);
117
+ }
118
+ deps = [...new Set(deps)];
119
+ peerDeps = [...new Set(peerDeps)];
120
+ return {
121
+ dependencies: deps.filter((x, i) => i === deps.indexOf(x)),
122
+ optionalPeerDependencies: peerDeps.filter((x, i) => i === peerDeps.indexOf(x))
123
+ };
134
124
  }
125
+ /**
126
+ * Filter out the dependencies we don't want
127
+ * @param deps
128
+ * @param filters
129
+ */
135
130
  function filterDependencies(deps, filters) {
136
- const depsDeduped = deps.filter((x, i) => i === deps.indexOf(x));
137
- const depsWithLength = depsDeduped.filter((dep) => dep.length > 0).sort();
138
- const exclude = new RegExp(`${filters.join("|")}`);
139
- const internal = [];
140
- const external = [];
141
- for (const dep of depsWithLength) {
142
- if (exclude.test(dep)) {
143
- external.push(dep);
144
- } else {
145
- internal.push(dep);
146
- }
147
- }
148
- return { internal, external };
131
+ const depsWithLength = deps.filter((x, i) => i === deps.indexOf(x)).filter((dep) => dep.length > 0).sort();
132
+ const exclude = new RegExp(`${filters.join("|")}`);
133
+ const internal = [];
134
+ const external = [];
135
+ for (const dep of depsWithLength) if (exclude.test(dep)) external.push(dep);
136
+ else internal.push(dep);
137
+ return {
138
+ internal,
139
+ external
140
+ };
149
141
  }
142
+ //#endregion
150
143
  exports.filterDependencies = filterDependencies;
151
144
  exports.getDependencies = getDependencies;
152
145
  exports.getExternalsFromReferences = getExternalsFromReferences;
@@ -1,33 +1,32 @@
1
- "use strict";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./vite/index.cjs");
4
- const dependencies = require("./dependencies.cjs");
5
- require("./webpack/index.cjs");
6
- const vitePluginCloseAndCopy = require("./vite/vite-plugin-close-and-copy.cjs");
7
- const vite_test_config = require("./vite/vite.test.config.cjs");
8
- const vite_threads_test_config = require("./vite/vite.threads.test.config.cjs");
9
- const vitePluginSourcemapExclude = require("./vite/vite-plugin-sourcemap-exclude.cjs");
10
- const vite_frontend_config = require("./vite/vite.frontend.config.cjs");
11
- const vite_backend_config = require("./vite/vite.backend.config.cjs");
12
- const vitePluginFixAbsoluteImports = require("./vite/vite-plugin-fix-absolute-imports.cjs");
13
- const vite_commonjs_config = require("./vite/vite.commonjs.config.cjs");
14
- const vite_esm_config = require("./vite/vite.esm.config.cjs");
15
- const vitePluginRemoveUnusedTranslations = require("./vite/vite-plugin-remove-unused-translations.cjs");
16
- const vitePluginCopy = require("./vite/vite-plugin-copy.cjs");
17
- const TsNoCheckPlugin = require("./vite/TsNoCheckPlugin.cjs");
18
- exports.filterDependencies = dependencies.filterDependencies;
19
- exports.getDependencies = dependencies.getDependencies;
20
- exports.getExternalsFromReferences = dependencies.getExternalsFromReferences;
21
- exports.getTsConfigs = dependencies.getTsConfigs;
22
- exports.VitePluginCloseAndCopy = vitePluginCloseAndCopy;
23
- exports.ViteTestConfig = vite_test_config;
24
- exports.ViteThreadsTestConfig = vite_threads_test_config;
25
- exports.VitePluginSourceMapExclude = vitePluginSourcemapExclude;
26
- exports.ViteFrontendConfig = vite_frontend_config;
27
- exports.ViteBackendConfig = vite_backend_config;
28
- exports.VitePluginFixAbsoluteImports = vitePluginFixAbsoluteImports;
29
- exports.ViteCommonJSConfig = vite_commonjs_config;
30
- exports.ViteEsmConfig = vite_esm_config;
31
- exports.VitePluginRemoveUnusedTranslations = vitePluginRemoveUnusedTranslations.default;
32
- exports.VitePluginCopy = vitePluginCopy;
33
- exports.tsNoCheckPlugin = TsNoCheckPlugin.tsNoCheckPlugin;
2
+ const require_vite_plugin_close_and_copy = require("./vite/vite-plugin-close-and-copy.cjs");
3
+ const require_vite_plugin_externalize_obfuscator_deadcode = require("./vite/vite-plugin-externalize-obfuscator-deadcode.cjs");
4
+ const require_vite_plugin_sourcemap_exclude = require("./vite/vite-plugin-sourcemap-exclude.cjs");
5
+ const require_vite_test_config = require("./vite/vite.test.config.cjs");
6
+ const require_vite_threads_test_config = require("./vite/vite.threads.test.config.cjs");
7
+ const require_dependencies = require("./dependencies.cjs");
8
+ const require_vite_frontend_config = require("./vite/vite.frontend.config.cjs");
9
+ const require_vite_plugin_fix_absolute_imports = require("./vite/vite-plugin-fix-absolute-imports.cjs");
10
+ const require_vite_backend_config = require("./vite/vite.backend.config.cjs");
11
+ const require_vite_plugin_copy = require("./vite/vite-plugin-copy.cjs");
12
+ const require_vite_commonjs_config = require("./vite/vite.commonjs.config.cjs");
13
+ const require_vite_esm_config = require("./vite/vite.esm.config.cjs");
14
+ const require_vite_plugin_remove_unused_translations = require("./vite/vite-plugin-remove-unused-translations.cjs");
15
+ const require_TsNoCheckPlugin = require("./vite/TsNoCheckPlugin.cjs");
16
+ exports.ViteBackendConfig = require_vite_backend_config.default;
17
+ exports.ViteCommonJSConfig = require_vite_commonjs_config.default;
18
+ exports.ViteEsmConfig = require_vite_esm_config.default;
19
+ exports.ViteFrontendConfig = require_vite_frontend_config.default;
20
+ exports.VitePluginCloseAndCopy = require_vite_plugin_close_and_copy.default;
21
+ exports.VitePluginCopy = require_vite_plugin_copy.default;
22
+ exports.VitePluginExternalizeObfuscatorDeadCode = require_vite_plugin_externalize_obfuscator_deadcode.default;
23
+ exports.VitePluginFixAbsoluteImports = require_vite_plugin_fix_absolute_imports.default;
24
+ exports.VitePluginRemoveUnusedTranslations = require_vite_plugin_remove_unused_translations.default;
25
+ exports.VitePluginSourceMapExclude = require_vite_plugin_sourcemap_exclude.default;
26
+ exports.ViteTestConfig = require_vite_test_config.default;
27
+ exports.ViteThreadsTestConfig = require_vite_threads_test_config.default;
28
+ exports.filterDependencies = require_dependencies.filterDependencies;
29
+ exports.getDependencies = require_dependencies.getDependencies;
30
+ exports.getExternalsFromReferences = require_dependencies.getExternalsFromReferences;
31
+ exports.getTsConfigs = require_dependencies.getTsConfigs;
32
+ exports.tsNoCheckPlugin = require_TsNoCheckPlugin.tsNoCheckPlugin;
@@ -1,18 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ //#region src/vite/TsNoCheckPlugin.ts
3
2
  function tsNoCheckPlugin() {
4
- return {
5
- name: "vite-plugin-ts-nocheck",
6
- // biome-ignore lint/suspicious/noExplicitAny: TODO not sure of options/bundle type (same as NodejsPolarsNativeFilePlugin)
7
- generateBundle(_, bundle) {
8
- for (const fileName in bundle) {
9
- const chunk = bundle[fileName];
10
- if (chunk.type === "chunk" && chunk.code) {
11
- chunk.code = `// @ts-nocheck
12
- ${chunk.code}`;
13
- }
14
- }
15
- }
16
- };
3
+ return {
4
+ name: "vite-plugin-ts-nocheck",
5
+ generateBundle(_, bundle) {
6
+ for (const fileName in bundle) {
7
+ const chunk = bundle[fileName];
8
+ if (chunk.type === "chunk" && chunk.code) chunk.code = `// @ts-nocheck\n${chunk.code}`;
9
+ }
10
+ }
11
+ };
17
12
  }
13
+ //#endregion
18
14
  exports.tsNoCheckPlugin = tsNoCheckPlugin;