@prosopo/config 3.3.3 → 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.
- package/.turbo/turbo-build$colon$cjs.log +27 -24
- package/.turbo/turbo-build$colon$tsc.log +4 -4
- package/.turbo/turbo-build.log +28 -24
- package/CHANGELOG.md +37 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/dependencies.cjs +130 -137
- package/dist/cjs/index.cjs +31 -32
- package/dist/cjs/vite/TsNoCheckPlugin.cjs +11 -15
- package/dist/cjs/vite/index.cjs +26 -26
- package/dist/cjs/vite/vite-plugin-close-and-copy.cjs +42 -42
- package/dist/cjs/vite/vite-plugin-copy.cjs +39 -38
- package/dist/cjs/vite/vite-plugin-externalize-obfuscator-deadcode.cjs +25 -0
- package/dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs +16 -24
- package/dist/cjs/vite/vite-plugin-remove-unused-translations.cjs +53 -74
- package/dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs +12 -15
- package/dist/cjs/vite/vite.backend.config.cjs +87 -104
- package/dist/cjs/vite/vite.commonjs.config.cjs +69 -74
- package/dist/cjs/vite/vite.esm.config.cjs +71 -70
- package/dist/cjs/vite/vite.frontend.config.cjs +173 -203
- package/dist/cjs/vite/vite.test.config.cjs +70 -80
- package/dist/cjs/vite/vite.threads.test.config.cjs +67 -78
- package/dist/cjs/webpack/index.cjs +0 -2
- package/dist/cjs/webpack/webpack.config.cjs +108 -146
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +123 -138
- package/dist/dependencies.js.map +1 -1
- package/dist/index.js +14 -31
- package/dist/vite/TsNoCheckPlugin.js +12 -16
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +13 -25
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/vite-plugin-close-and-copy.js +37 -41
- package/dist/vite/vite-plugin-copy.js +32 -36
- package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.d.ts +3 -0
- package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.d.ts.map +1 -0
- package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.js +25 -0
- package/dist/vite/vite-plugin-externalize-obfuscator-deadcode.js.map +1 -0
- package/dist/vite/vite-plugin-fix-absolute-imports.js +15 -24
- package/dist/vite/vite-plugin-remove-unused-translations.js +50 -76
- package/dist/vite/vite-plugin-sourcemap-exclude.js +12 -16
- package/dist/vite/vite.backend.config.d.ts.map +1 -1
- package/dist/vite/vite.backend.config.js +80 -101
- package/dist/vite/vite.backend.config.js.map +1 -1
- package/dist/vite/vite.commonjs.config.d.ts.map +1 -1
- package/dist/vite/vite.commonjs.config.js +61 -71
- package/dist/vite/vite.commonjs.config.js.map +1 -1
- package/dist/vite/vite.esm.config.d.ts.map +1 -1
- package/dist/vite/vite.esm.config.js +63 -67
- package/dist/vite/vite.esm.config.js.map +1 -1
- package/dist/vite/vite.frontend.config.d.ts.map +1 -1
- package/dist/vite/vite.frontend.config.js +159 -196
- package/dist/vite/vite.frontend.config.js.map +1 -1
- package/dist/vite/vite.test.config.d.ts.map +1 -1
- package/dist/vite/vite.test.config.js +63 -78
- package/dist/vite/vite.test.config.js.map +1 -1
- package/dist/vite/vite.threads.test.config.d.ts.map +1 -1
- package/dist/vite/vite.threads.test.config.js +61 -76
- package/dist/vite/vite.threads.test.config.js.map +1 -1
- package/dist/webpack/index.js +1 -1
- package/dist/webpack/webpack.config.d.ts +2 -0
- package/dist/webpack/webpack.config.d.ts.map +1 -1
- package/dist/webpack/webpack.config.js +96 -119
- package/dist/webpack/webpack.config.js.map +1 -1
- package/package.json +10 -9
- package/src/dependencies.ts +15 -2
- package/src/vite/index.ts +1 -0
- package/src/vite/vite-plugin-externalize-obfuscator-deadcode.ts +43 -0
- package/src/vite/vite.backend.config.ts +19 -2
- package/src/vite/vite.commonjs.config.ts +2 -0
- package/src/vite/vite.esm.config.ts +12 -0
- package/src/vite/vite.frontend.config.ts +38 -14
- package/src/vite/vite.test.config.ts +15 -10
- package/src/vite/vite.threads.test.config.ts +6 -9
- package/src/webpack/webpack.config.ts +8 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.cjs.config.ts +4 -0
- package/vite.esm.config.ts +9 -1
- package/.turbo/turbo-typecheck.log +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/config",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "Prosopo config library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
22
22
|
"@rollup/plugin-typescript": "11.1.6",
|
|
23
23
|
"@rollup/plugin-wasm": "6.2.2",
|
|
24
|
-
"@vitejs/plugin-react": "
|
|
24
|
+
"@vitejs/plugin-react": "6.0.4",
|
|
25
25
|
"esbuild": "0.28.1",
|
|
26
26
|
"fast-glob": "3.3.2",
|
|
27
27
|
"html-webpack-plugin": "5.6.0",
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"node-polyfill-webpack-plugin": "4.1.0",
|
|
30
30
|
"rollup": "4.52.5",
|
|
31
31
|
"rollup-plugin-import-css": "4.1.1",
|
|
32
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
32
33
|
"terser-webpack-plugin": "5.3.14",
|
|
33
34
|
"vite-plugin-no-bundle": "4.0.0",
|
|
34
|
-
"vite-tsconfig-paths": "
|
|
35
|
+
"vite-tsconfig-paths": "6.1.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@babel/plugin-proposal-import-attributes-to-assertions": "7.27.1",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"@rollup/plugin-dynamic-import-vars": "2.1.5",
|
|
48
49
|
"@rollup/plugin-json": "6.1.0",
|
|
49
50
|
"@types/node": "22.10.2",
|
|
50
|
-
"@vitest/coverage-v8": "
|
|
51
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
51
52
|
"babel-loader": "9.2.1",
|
|
52
53
|
"concurrently": "9.0.1",
|
|
53
54
|
"css-loader": "7.1.2",
|
|
@@ -60,14 +61,14 @@
|
|
|
60
61
|
"tslib": "2.7.0",
|
|
61
62
|
"tsx": "4.20.6",
|
|
62
63
|
"typescript": "5.6.2",
|
|
63
|
-
"vite": "
|
|
64
|
+
"vite": "8.1.5",
|
|
64
65
|
"vite-bundle-visualizer": "1.2.1",
|
|
65
|
-
"vite-plugin-node-polyfills": "0.
|
|
66
|
-
"vite-tsconfig-paths": "
|
|
67
|
-
"vitest": "
|
|
66
|
+
"vite-plugin-node-polyfills": "0.28.0",
|
|
67
|
+
"vite-tsconfig-paths": "6.1.1",
|
|
68
|
+
"vitest": "4.1.10",
|
|
68
69
|
"webpack": "5.102.1",
|
|
69
70
|
"webpack-cli": "5.1.4",
|
|
70
|
-
"webpack-dev-server": "5.2.
|
|
71
|
+
"webpack-dev-server": "5.2.6"
|
|
71
72
|
},
|
|
72
73
|
"repository": {
|
|
73
74
|
"type": "git",
|
package/src/dependencies.ts
CHANGED
|
@@ -185,8 +185,21 @@ export async function getDependencies(
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
let concat = "";
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
// `npm ls` exits non-zero on any invalid/unmet/extraneous dependency (e.g.
|
|
189
|
+
// Vite 8's optional `yaml` peer being satisfied by a hoisted v1 from
|
|
190
|
+
// cosmiconfig). It still prints the full tree to stdout in that case, so we
|
|
191
|
+
// tolerate the non-zero exit and parse whatever was emitted.
|
|
192
|
+
try {
|
|
193
|
+
const { stdout, stderr } = await exec(cmd);
|
|
194
|
+
concat = stdout + stderr;
|
|
195
|
+
} catch (error) {
|
|
196
|
+
const execError = error as { stdout?: string; stderr?: string };
|
|
197
|
+
if (typeof execError.stdout === "string") {
|
|
198
|
+
concat = execError.stdout + (execError.stderr ?? "");
|
|
199
|
+
} else {
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
190
203
|
|
|
191
204
|
let deps: string[] = [];
|
|
192
205
|
let peerDeps: string[] = [];
|
package/src/vite/index.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
export { default as VitePluginCloseAndCopy } from "./vite-plugin-close-and-copy.js";
|
|
15
|
+
export { default as VitePluginExternalizeObfuscatorDeadCode } from "./vite-plugin-externalize-obfuscator-deadcode.js";
|
|
15
16
|
export { default as ViteTestConfig } from "./vite.test.config.js";
|
|
16
17
|
export { default as ViteThreadsTestConfig } from "./vite.threads.test.config.js";
|
|
17
18
|
export { default as VitePluginSourceMapExclude } from "./vite-plugin-sourcemap-exclude.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright 2021-2026 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import type { Plugin } from "vite";
|
|
15
|
+
|
|
16
|
+
// js-confuser's `deadCode` transform injects a fixed set of fake `require()`
|
|
17
|
+
// specifiers into obfuscated sources as unreachable dead code. Rollup (Vite 6)
|
|
18
|
+
// left unresolved imports external with a warning, so these harmless specifiers
|
|
19
|
+
// never broke the build. Rolldown (Vite 8) treats an unresolved import as a hard
|
|
20
|
+
// error, so we restore the old behaviour by marking exactly these known
|
|
21
|
+
// dead-code specifiers as external. They are never executed at runtime.
|
|
22
|
+
const OBFUSCATOR_DEADCODE_SPECIFIERS: ReadonlySet<string> = new Set([
|
|
23
|
+
"../../package",
|
|
24
|
+
"../redacted.js",
|
|
25
|
+
"../utils/isStandaloneExecutable",
|
|
26
|
+
"./resolve-local-redacted-path",
|
|
27
|
+
"@redacted/components/package",
|
|
28
|
+
"@redacted/enterprise-plugin",
|
|
29
|
+
"@redacted/enterprise-plugin/package",
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export default function VitePluginExternalizeObfuscatorDeadCode(): Plugin {
|
|
33
|
+
return {
|
|
34
|
+
name: "externalize-obfuscator-deadcode",
|
|
35
|
+
enforce: "pre",
|
|
36
|
+
resolveId(source: string) {
|
|
37
|
+
if (OBFUSCATOR_DEADCODE_SPECIFIERS.has(source)) {
|
|
38
|
+
return { id: source, external: true };
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -20,6 +20,7 @@ import css from "rollup-plugin-import-css";
|
|
|
20
20
|
import type { UserConfig } from "vite";
|
|
21
21
|
import { filterDependencies, getDependencies } from "../dependencies.js";
|
|
22
22
|
import { default as ClosePlugin } from "./vite-plugin-close-and-copy.js";
|
|
23
|
+
import VitePluginExternalizeObfuscatorDeadCode from "./vite-plugin-externalize-obfuscator-deadcode.js";
|
|
23
24
|
import VitePluginFixAbsoluteImports from "./vite-plugin-fix-absolute-imports.js";
|
|
24
25
|
|
|
25
26
|
export default async function (
|
|
@@ -51,9 +52,18 @@ export default async function (
|
|
|
51
52
|
"biome",
|
|
52
53
|
]);
|
|
53
54
|
|
|
55
|
+
// `punycode` is a deprecated Node builtin that the userland npm package
|
|
56
|
+
// shadows. Rolldown prefix-matches string externals, so listing the builtin
|
|
57
|
+
// also externalises deep imports like "punycode/punycode.es6.js" (which
|
|
58
|
+
// uri-js pulls in). Rollup did not, so this only bites under Vite 8. The
|
|
59
|
+
// provider image ships the bundle with no node_modules, so an external
|
|
60
|
+
// subpath is an immediate "Cannot find module" at boot. Bare "punycode"
|
|
61
|
+
// stays external via the node: alias below.
|
|
62
|
+
const bundledBuiltins = builtinModules.filter((m) => m !== "punycode");
|
|
63
|
+
|
|
54
64
|
// Add the node builtins (path, fs, os, etc.) to the external list
|
|
55
65
|
const allExternal = [
|
|
56
|
-
...
|
|
66
|
+
...bundledBuiltins,
|
|
57
67
|
...builtinModules.map((m) => `node:${m}`),
|
|
58
68
|
...external,
|
|
59
69
|
...optionalPeerDependencies,
|
|
@@ -128,7 +138,13 @@ export default async function (
|
|
|
128
138
|
},
|
|
129
139
|
modulePreload: { polyfill: false },
|
|
130
140
|
rollupOptions: {
|
|
131
|
-
treeshake:
|
|
141
|
+
treeshake: {
|
|
142
|
+
// Rolldown has no `preset` support, so Rollup's "smallest" could
|
|
143
|
+
// not be carried over. Honouring pure annotations recovers part
|
|
144
|
+
// of that without the risk of moduleSideEffects: false.
|
|
145
|
+
annotations: true,
|
|
146
|
+
moduleSideEffects: true,
|
|
147
|
+
},
|
|
132
148
|
external: allExternal,
|
|
133
149
|
watch: false,
|
|
134
150
|
output: {
|
|
@@ -139,6 +155,7 @@ export default async function (
|
|
|
139
155
|
},
|
|
140
156
|
},
|
|
141
157
|
plugins: [
|
|
158
|
+
VitePluginExternalizeObfuscatorDeadCode(),
|
|
142
159
|
// plugin to replace stuff like import blah from string_encoder/lib/string_encoder.js with import blah from string_encoder
|
|
143
160
|
VitePluginFixAbsoluteImports(),
|
|
144
161
|
// plugin to close the bundle after build if not in serve mode
|
|
@@ -20,6 +20,7 @@ import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
20
20
|
import { getExternalsFromReferences } from "../dependencies.js";
|
|
21
21
|
import VitePluginCloseAndCopy from "./vite-plugin-close-and-copy.js";
|
|
22
22
|
import VitePluginCopy from "./vite-plugin-copy.js";
|
|
23
|
+
import VitePluginExternalizeObfuscatorDeadCode from "./vite-plugin-externalize-obfuscator-deadcode.js";
|
|
23
24
|
|
|
24
25
|
export default async function (
|
|
25
26
|
name: string,
|
|
@@ -38,6 +39,7 @@ export default async function (
|
|
|
38
39
|
return defineConfig({
|
|
39
40
|
ssr: { external: allExternal },
|
|
40
41
|
plugins: [
|
|
42
|
+
VitePluginExternalizeObfuscatorDeadCode(),
|
|
41
43
|
// @ts-ignore
|
|
42
44
|
{
|
|
43
45
|
name: "string-replace-import.meta.url",
|
|
@@ -20,6 +20,7 @@ import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
20
20
|
import { getExternalsFromReferences } from "../dependencies.js";
|
|
21
21
|
import VitePluginCloseAndCopy from "./vite-plugin-close-and-copy.js";
|
|
22
22
|
import VitePluginCopy from "./vite-plugin-copy.js";
|
|
23
|
+
import VitePluginExternalizeObfuscatorDeadCode from "./vite-plugin-externalize-obfuscator-deadcode.js";
|
|
23
24
|
|
|
24
25
|
export default async function (
|
|
25
26
|
name: string,
|
|
@@ -49,6 +50,7 @@ export default async function (
|
|
|
49
50
|
return defineConfig({
|
|
50
51
|
ssr: { external: allExternal },
|
|
51
52
|
plugins: [
|
|
53
|
+
VitePluginExternalizeObfuscatorDeadCode(),
|
|
52
54
|
// @ts-ignore
|
|
53
55
|
noBundlePlugin({
|
|
54
56
|
root: "src",
|
|
@@ -75,6 +77,16 @@ export default async function (
|
|
|
75
77
|
rollupOptions: {
|
|
76
78
|
treeshake: false,
|
|
77
79
|
external: allExternal,
|
|
80
|
+
output: {
|
|
81
|
+
// Rolldown otherwise emits a CJS-interop runtime that does
|
|
82
|
+
// `createRequire(import.meta.url)` from "node:module" at module
|
|
83
|
+
// scope. That is fatal in a browser: anything importing such a
|
|
84
|
+
// package (e.g. catcher-demo importing @prosopo/util) dies with
|
|
85
|
+
// 'Module "node:module" has been externalized for browser
|
|
86
|
+
// compatibility' before React can mount. Rollup emitted no such
|
|
87
|
+
// runtime, so this only bites under Vite 8.
|
|
88
|
+
polyfillRequire: false,
|
|
89
|
+
},
|
|
78
90
|
},
|
|
79
91
|
},
|
|
80
92
|
esbuild: {
|
|
@@ -21,11 +21,13 @@ import { default as viteReact } from "@vitejs/plugin-react";
|
|
|
21
21
|
import type { Drop } from "esbuild";
|
|
22
22
|
import type { ExternalOption } from "rollup";
|
|
23
23
|
import css from "rollup-plugin-import-css";
|
|
24
|
+
import { visualizer } from "rollup-plugin-visualizer";
|
|
24
25
|
import type { UserConfig } from "vite";
|
|
25
26
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
26
27
|
import { filterDependencies, getDependencies } from "../dependencies.js";
|
|
27
28
|
import { VitePluginCloseAndCopy } from "./index.js";
|
|
28
29
|
import type { ClosePluginOptions } from "./vite-plugin-close-and-copy.js";
|
|
30
|
+
import VitePluginExternalizeObfuscatorDeadCode from "./vite-plugin-externalize-obfuscator-deadcode.js";
|
|
29
31
|
|
|
30
32
|
export default async function (
|
|
31
33
|
packageName: string,
|
|
@@ -51,6 +53,11 @@ export default async function (
|
|
|
51
53
|
|
|
52
54
|
console.info(`Running at ${dir} in ${mode} mode`);
|
|
53
55
|
const isProduction = mode === "production";
|
|
56
|
+
// Rollup bundle stats (rollup-plugin-visualizer treemap). Off by default —
|
|
57
|
+
// set PROSOPO_BUNDLE_STATS=true to generate the stats page and open it in
|
|
58
|
+
// the browser once the bundle has been built.
|
|
59
|
+
const openBundleStats =
|
|
60
|
+
process.env.PROSOPO_BUNDLE_STATS?.trim().toLowerCase() === "true";
|
|
54
61
|
// NODE_ENV must be wrapped in quotes.
|
|
55
62
|
// If NODE_ENV ends up out of sync (one set to development and the other set to production), it causes
|
|
56
63
|
// issues like this: https://github.com/hashicorp/next-mdx-remote/pull/323
|
|
@@ -182,14 +189,20 @@ export default async function (
|
|
|
182
189
|
|
|
183
190
|
rollupOptions: {
|
|
184
191
|
treeshake: {
|
|
185
|
-
annotations
|
|
192
|
+
// Respect /*#__PURE__*/ annotations. Ignoring them retained
|
|
193
|
+
// dead library calls that every consumer then shipped;
|
|
194
|
+
// honouring them cuts ~17KB gzip off the widget bundle with
|
|
195
|
+
// a byte-identical detector.
|
|
196
|
+
annotations: true,
|
|
186
197
|
propertyReadSideEffects: false,
|
|
187
|
-
|
|
188
|
-
moduleSideEffects:
|
|
189
|
-
|
|
198
|
+
// Measured alternatives, both rejected:
|
|
199
|
+
// moduleSideEffects: false -> widget 8KB gzip LARGER
|
|
200
|
+
// propertyWriteSideEffects: false -> detector dies on load
|
|
201
|
+
// ("Maximum call stack
|
|
202
|
+
// size exceeded")
|
|
203
|
+
moduleSideEffects: "no-external",
|
|
190
204
|
unknownGlobalSideEffects: false,
|
|
191
205
|
},
|
|
192
|
-
experimentalLogSideEffects: false,
|
|
193
206
|
external: rollupExternal,
|
|
194
207
|
watch: false,
|
|
195
208
|
|
|
@@ -199,9 +212,6 @@ export default async function (
|
|
|
199
212
|
},
|
|
200
213
|
|
|
201
214
|
plugins: [
|
|
202
|
-
nodePolyfills({
|
|
203
|
-
include: ["crypto"],
|
|
204
|
-
}),
|
|
205
215
|
// biome-ignore lint/suspicious/noExplicitAny: has to be any to represent object prototype
|
|
206
216
|
css() as any,
|
|
207
217
|
// biome-ignore lint/suspicious/noExplicitAny: has to be any to represent object prototype
|
|
@@ -235,12 +245,19 @@ export default async function (
|
|
|
235
245
|
}
|
|
236
246
|
},
|
|
237
247
|
},
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
// Bundle stats page — only wired in (and opened in the
|
|
249
|
+
// browser) when PROSOPO_BUNDLE_STATS=true. Defaults off so
|
|
250
|
+
// normal builds neither emit the report nor pop a window.
|
|
251
|
+
...(openBundleStats
|
|
252
|
+
? [
|
|
253
|
+
visualizer({
|
|
254
|
+
open: true,
|
|
255
|
+
template: "treemap",
|
|
256
|
+
gzipSize: true,
|
|
257
|
+
brotliSize: true,
|
|
258
|
+
}),
|
|
259
|
+
]
|
|
260
|
+
: []),
|
|
244
261
|
// I think we can use this plugin to build all packages instead of relying on the tsc step that's
|
|
245
262
|
// currently a precursor in package.json. However, it fails for the following reason:
|
|
246
263
|
// https://github.com/rollup/plugins/issues/243
|
|
@@ -254,6 +271,13 @@ export default async function (
|
|
|
254
271
|
},
|
|
255
272
|
},
|
|
256
273
|
plugins: [
|
|
274
|
+
VitePluginExternalizeObfuscatorDeadCode(),
|
|
275
|
+
// node polyfills must be a top-level Vite plugin (not inside
|
|
276
|
+
// build.rollupOptions.plugins) so its inject sub-plugin initialises
|
|
277
|
+
// before transform runs under Rolldown/Vite 8.
|
|
278
|
+
nodePolyfills({
|
|
279
|
+
include: ["crypto"],
|
|
280
|
+
}),
|
|
257
281
|
// Not sure if we need this plugin or not, it works without it
|
|
258
282
|
// @ts-ignore
|
|
259
283
|
viteReact(),
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
|
+
import fs from "node:fs";
|
|
15
16
|
import path from "node:path";
|
|
16
17
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
17
18
|
import { defineConfig } from "vitest/config";
|
|
@@ -30,10 +31,18 @@ export default function (tsConfigPath?: string) {
|
|
|
30
31
|
: "@(|)";
|
|
31
32
|
console.log(`Filtering tests by type: ${testTypeGlob}`);
|
|
32
33
|
|
|
33
|
-
// Determine coverage include paths based on current working directory
|
|
34
|
+
// Determine coverage include paths based on current working directory.
|
|
35
|
+
//
|
|
36
|
+
// Detected by looking for a package alongside the cwd rather than by
|
|
37
|
+
// matching "/packages/" in the path: workspaces also live in dev/, demos/
|
|
38
|
+
// and integration/, and those were falling through to the repo-root globs
|
|
39
|
+
// below, which match `packages/*/src/**` only — so they reported 0/0
|
|
40
|
+
// coverage no matter what their tests exercised. Neither repo root has a
|
|
41
|
+
// `src` directory, so this cannot misfire in the other direction.
|
|
34
42
|
const cwd = process.cwd();
|
|
35
43
|
const isRunningFromPackage =
|
|
36
|
-
|
|
44
|
+
fs.existsSync(path.join(cwd, "package.json")) &&
|
|
45
|
+
fs.existsSync(path.join(cwd, "src"));
|
|
37
46
|
|
|
38
47
|
// If running from a package directory, include local src files
|
|
39
48
|
// If running from repo root, include all package src files
|
|
@@ -73,8 +82,6 @@ export default function (tsConfigPath?: string) {
|
|
|
73
82
|
minify: false,
|
|
74
83
|
sourcemap: false,
|
|
75
84
|
rollupOptions: {
|
|
76
|
-
maxParallelFileOps: 1,
|
|
77
|
-
cache: false,
|
|
78
85
|
output: {
|
|
79
86
|
sourcemap: false,
|
|
80
87
|
},
|
|
@@ -82,7 +89,9 @@ export default function (tsConfigPath?: string) {
|
|
|
82
89
|
},
|
|
83
90
|
test: {
|
|
84
91
|
//root: getRootDir(),
|
|
85
|
-
|
|
92
|
+
// vitest 4 removed the "basic" reporter; the default reporter with
|
|
93
|
+
// summary disabled reproduces its terse output.
|
|
94
|
+
reporters: [["default", { summary: false }]],
|
|
86
95
|
include: [include],
|
|
87
96
|
watch: false,
|
|
88
97
|
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
@@ -96,11 +105,7 @@ export default function (tsConfigPath?: string) {
|
|
|
96
105
|
enabled: true,
|
|
97
106
|
},
|
|
98
107
|
pool: "forks", // forks is slower than 'threads' but more compatible with low-level libs (e.g. bcrypt)
|
|
99
|
-
|
|
100
|
-
forks: {
|
|
101
|
-
isolate: true,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
108
|
+
isolate: true,
|
|
104
109
|
sequence: {
|
|
105
110
|
shuffle: true,
|
|
106
111
|
},
|
|
@@ -73,8 +73,6 @@ export default function (tsConfigPath?: string) {
|
|
|
73
73
|
minify: false,
|
|
74
74
|
sourcemap: false,
|
|
75
75
|
rollupOptions: {
|
|
76
|
-
maxParallelFileOps: 1,
|
|
77
|
-
cache: false,
|
|
78
76
|
output: {
|
|
79
77
|
sourcemap: false,
|
|
80
78
|
},
|
|
@@ -82,7 +80,9 @@ export default function (tsConfigPath?: string) {
|
|
|
82
80
|
},
|
|
83
81
|
test: {
|
|
84
82
|
//root: getRootDir(),
|
|
85
|
-
|
|
83
|
+
// vitest 4 removed the "basic" reporter; the default reporter with
|
|
84
|
+
// summary disabled reproduces its terse output.
|
|
85
|
+
reporters: [["default", { summary: false }]],
|
|
86
86
|
include: [include],
|
|
87
87
|
watch: false,
|
|
88
88
|
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
@@ -96,12 +96,9 @@ export default function (tsConfigPath?: string) {
|
|
|
96
96
|
enabled: true,
|
|
97
97
|
},
|
|
98
98
|
pool: "threads", // use threads for tests that should be run sequentially
|
|
99
|
-
poolOptions
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
maxThreads: 1,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
99
|
+
// vitest 4 removed poolOptions; sequential execution is now expressed via
|
|
100
|
+
// fileParallelism instead of min/maxThreads.
|
|
101
|
+
fileParallelism: false,
|
|
105
102
|
testTimeout: 10000,
|
|
106
103
|
},
|
|
107
104
|
plugins: plugins,
|
|
@@ -80,7 +80,14 @@ export default (mode: string) => {
|
|
|
80
80
|
"@babel/plugin-transform-runtime",
|
|
81
81
|
"@babel/transform-class-properties",
|
|
82
82
|
"@babel/transform-object-rest-spread",
|
|
83
|
-
"
|
|
83
|
+
// runtime must be "automatic": rolldown keeps the
|
|
84
|
+
// `@jsxImportSource @emotion/react` pragma in the emitted
|
|
85
|
+
// dist files (rollup dropped it), and babel rejects that
|
|
86
|
+
// pragma under the default "classic" runtime with
|
|
87
|
+
// "importSource cannot be set when runtime is classic".
|
|
88
|
+
// The JSX in those files is already transformed, so this
|
|
89
|
+
// only affects how the leftover pragma is interpreted.
|
|
90
|
+
["@babel/plugin-transform-react-jsx", { runtime: "automatic" }],
|
|
84
91
|
[
|
|
85
92
|
"@babel/plugin-syntax-import-attributes",
|
|
86
93
|
{ deprecatedAssertSyntax: true },
|