@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.
- 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 +27 -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 -210
- 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 +158 -202
- 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 +9 -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 +19 -8
- 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/dist/cjs/vite/index.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.VitePluginFixAbsoluteImports =
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
1
|
+
const require_vite_plugin_close_and_copy = require("./vite-plugin-close-and-copy.cjs");
|
|
2
|
+
const require_vite_plugin_externalize_obfuscator_deadcode = require("./vite-plugin-externalize-obfuscator-deadcode.cjs");
|
|
3
|
+
const require_vite_plugin_sourcemap_exclude = require("./vite-plugin-sourcemap-exclude.cjs");
|
|
4
|
+
const require_vite_test_config = require("./vite.test.config.cjs");
|
|
5
|
+
const require_vite_threads_test_config = require("./vite.threads.test.config.cjs");
|
|
6
|
+
const require_vite_frontend_config = require("./vite.frontend.config.cjs");
|
|
7
|
+
const require_vite_plugin_fix_absolute_imports = require("./vite-plugin-fix-absolute-imports.cjs");
|
|
8
|
+
const require_vite_backend_config = require("./vite.backend.config.cjs");
|
|
9
|
+
const require_vite_plugin_copy = require("./vite-plugin-copy.cjs");
|
|
10
|
+
const require_vite_commonjs_config = require("./vite.commonjs.config.cjs");
|
|
11
|
+
const require_vite_esm_config = require("./vite.esm.config.cjs");
|
|
12
|
+
const require_vite_plugin_remove_unused_translations = require("./vite-plugin-remove-unused-translations.cjs");
|
|
13
|
+
const require_TsNoCheckPlugin = require("./TsNoCheckPlugin.cjs");
|
|
14
|
+
exports.ViteBackendConfig = require_vite_backend_config.default;
|
|
15
|
+
exports.ViteCommonJSConfig = require_vite_commonjs_config.default;
|
|
16
|
+
exports.ViteEsmConfig = require_vite_esm_config.default;
|
|
17
|
+
exports.ViteFrontendConfig = require_vite_frontend_config.default;
|
|
18
|
+
exports.VitePluginCloseAndCopy = require_vite_plugin_close_and_copy.default;
|
|
19
|
+
exports.VitePluginCopy = require_vite_plugin_copy.default;
|
|
20
|
+
exports.VitePluginExternalizeObfuscatorDeadCode = require_vite_plugin_externalize_obfuscator_deadcode.default;
|
|
21
|
+
exports.VitePluginFixAbsoluteImports = require_vite_plugin_fix_absolute_imports.default;
|
|
22
|
+
exports.VitePluginRemoveUnusedTranslations = require_vite_plugin_remove_unused_translations.default;
|
|
23
|
+
exports.VitePluginSourceMapExclude = require_vite_plugin_sourcemap_exclude.default;
|
|
24
|
+
exports.ViteTestConfig = require_vite_test_config.default;
|
|
25
|
+
exports.ViteThreadsTestConfig = require_vite_threads_test_config.default;
|
|
26
|
+
exports.tsNoCheckPlugin = require_TsNoCheckPlugin.tsNoCheckPlugin;
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
//#region src/vite/vite-plugin-close-and-copy.ts
|
|
7
|
+
/**
|
|
8
|
+
* description: Closes Vite after the bundle has been build. Optionally copies the bundle to a different directory.
|
|
9
|
+
* @param { ClosePluginOptions } options - The options object
|
|
10
|
+
**/
|
|
4
11
|
function VitePluginCloseAndCopy(options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
12
|
+
const __dirname = node_path.default.resolve();
|
|
13
|
+
return {
|
|
14
|
+
name: "close-plugin",
|
|
15
|
+
buildStart() {
|
|
16
|
+
console.info("Bundle build started");
|
|
17
|
+
},
|
|
18
|
+
buildEnd(error) {
|
|
19
|
+
console.info("Build end");
|
|
20
|
+
if (error) {
|
|
21
|
+
console.log(error);
|
|
22
|
+
console.error(error);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
closeBundle() {
|
|
26
|
+
if (options) {
|
|
27
|
+
for (const destDir of options.destDir) {
|
|
28
|
+
clearOutputDirJS(__dirname, destDir);
|
|
29
|
+
console.info(`Bundle cleared from ${options.destDir}`);
|
|
30
|
+
copyBundle(__dirname, options.srcDir, destDir);
|
|
31
|
+
console.info(`Bundle copied to ${options.destDir}`);
|
|
32
|
+
}
|
|
33
|
+
console.info("Bundle closed");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
var clearOutputDirJS = (__dirname, destDir) => node_fs.default.readdirSync(node_path.default.resolve(__dirname, destDir)).filter((file) => file.endsWith("js")).map((file) => {
|
|
39
|
+
node_fs.default.rmSync(node_path.default.resolve(__dirname, destDir, file));
|
|
34
40
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
path.resolve(__dirname, srcDir),
|
|
39
|
-
"to",
|
|
40
|
-
path.resolve(__dirname, destDir)
|
|
41
|
-
);
|
|
42
|
-
fs.cpSync(path.resolve(__dirname, srcDir), path.resolve(__dirname, destDir), {
|
|
43
|
-
recursive: true
|
|
44
|
-
});
|
|
41
|
+
var copyBundle = (__dirname, srcDir, destDir) => {
|
|
42
|
+
console.info("Copying", node_path.default.resolve(__dirname, srcDir), "to", node_path.default.resolve(__dirname, destDir));
|
|
43
|
+
node_fs.default.cpSync(node_path.default.resolve(__dirname, srcDir), node_path.default.resolve(__dirname, destDir), { recursive: true });
|
|
45
44
|
};
|
|
46
|
-
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.default = VitePluginCloseAndCopy;
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 fast_glob = require("fast-glob");
|
|
7
|
+
fast_glob = require_runtime.__toESM(fast_glob, 1);
|
|
8
|
+
//#region src/vite/vite-plugin-copy.ts
|
|
5
9
|
function ensureDirExists(filePath) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
9
|
-
}
|
|
10
|
+
const dir = node_path.default.dirname(filePath);
|
|
11
|
+
if (!node_fs.default.existsSync(dir)) node_fs.default.mkdirSync(dir, { recursive: true });
|
|
10
12
|
}
|
|
11
13
|
function VitePluginCopy(options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
};
|
|
14
|
+
const __dirname = node_path.default.resolve();
|
|
15
|
+
return {
|
|
16
|
+
name: "copy-plugin",
|
|
17
|
+
async closeBundle() {
|
|
18
|
+
const srcAbs = node_path.default.resolve(__dirname, options.srcDir);
|
|
19
|
+
const destAbs = node_path.default.resolve(__dirname, options.destDir);
|
|
20
|
+
const include = options.include && options.include.length > 0 ? options.include : void 0;
|
|
21
|
+
const exclude = options.exclude || [];
|
|
22
|
+
if (!include) {
|
|
23
|
+
console.info("[copy-plugin] No include globs specified, nothing to copy.");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const files = await (0, fast_glob.default)(include, {
|
|
27
|
+
cwd: srcAbs,
|
|
28
|
+
ignore: exclude,
|
|
29
|
+
onlyFiles: true,
|
|
30
|
+
absolute: false
|
|
31
|
+
});
|
|
32
|
+
for (const relFile of files) {
|
|
33
|
+
const srcFile = node_path.default.join(srcAbs, relFile);
|
|
34
|
+
const destFile = node_path.default.join(destAbs, relFile);
|
|
35
|
+
ensureDirExists(destFile);
|
|
36
|
+
console.info(`[copy-plugin] copying ${srcFile} to ${destFile}`);
|
|
37
|
+
node_fs.default.copyFileSync(srcFile, destFile);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.default = VitePluginCopy;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/vite/vite-plugin-externalize-obfuscator-deadcode.ts
|
|
2
|
+
var OBFUSCATOR_DEADCODE_SPECIFIERS = /* @__PURE__ */ new Set([
|
|
3
|
+
"../../package",
|
|
4
|
+
"../redacted.js",
|
|
5
|
+
"../utils/isStandaloneExecutable",
|
|
6
|
+
"./resolve-local-redacted-path",
|
|
7
|
+
"@redacted/components/package",
|
|
8
|
+
"@redacted/enterprise-plugin",
|
|
9
|
+
"@redacted/enterprise-plugin/package"
|
|
10
|
+
]);
|
|
11
|
+
function VitePluginExternalizeObfuscatorDeadCode() {
|
|
12
|
+
return {
|
|
13
|
+
name: "externalize-obfuscator-deadcode",
|
|
14
|
+
enforce: "pre",
|
|
15
|
+
resolveId(source) {
|
|
16
|
+
if (OBFUSCATOR_DEADCODE_SPECIFIERS.has(source)) return {
|
|
17
|
+
id: source,
|
|
18
|
+
external: true
|
|
19
|
+
};
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = VitePluginExternalizeObfuscatorDeadCode;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let node_module = require("node:module");
|
|
2
|
+
//#region src/vite/vite-plugin-fix-absolute-imports.ts
|
|
3
3
|
function VitePluginFixAbsoluteImports() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
code
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
enforce: "post"
|
|
24
|
-
};
|
|
4
|
+
return {
|
|
5
|
+
name: "fix-absolute-imports",
|
|
6
|
+
transform(code, id) {
|
|
7
|
+
for (const module of node_module.builtinModules) {
|
|
8
|
+
const moduleImportRegex = new RegExp(`from "(${module}(/.*)*/.*.js)";`, "g");
|
|
9
|
+
const matches = code.match(moduleImportRegex);
|
|
10
|
+
if (matches) for (const match of matches) code = code.replace(match, `from "${module}";`);
|
|
11
|
+
}
|
|
12
|
+
return { code };
|
|
13
|
+
},
|
|
14
|
+
enforce: "post"
|
|
15
|
+
};
|
|
25
16
|
}
|
|
26
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.default = VitePluginFixAbsoluteImports;
|
|
@@ -1,81 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return flattenedObj;
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let fast_glob = require("fast-glob");
|
|
3
|
+
fast_glob = require_runtime.__toESM(fast_glob, 1);
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
|
|
6
|
+
//#region src/vite/vite-plugin-remove-unused-translations.ts
|
|
7
|
+
var used = /* @__PURE__ */ new Set();
|
|
8
|
+
var flatten = (obj, prefix = "") => {
|
|
9
|
+
const flattenedObj = {};
|
|
10
|
+
for (const [key, value] of Object.entries(obj)) if (value instanceof Object) Object.assign(flattenedObj, flatten(value, `${prefix + key}.`));
|
|
11
|
+
else flattenedObj[prefix + key] = value;
|
|
12
|
+
return flattenedObj;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return acc[k];
|
|
30
|
-
}, result);
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
14
|
+
var unflatten = (obj) => {
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
17
|
+
const keys = key.split(".");
|
|
18
|
+
keys.reduce((acc, k, i) => {
|
|
19
|
+
if (i === keys.length - 1) acc[k] = value;
|
|
20
|
+
else if (!acc[k]) acc[k] = Number.isNaN(Number(keys[i + 1])) ? {} : [];
|
|
21
|
+
return acc[k];
|
|
22
|
+
}, result);
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
33
25
|
};
|
|
34
26
|
function VitePluginRemoveUnusedTranslations(translationKeys, jsonPattern) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"utf-8"
|
|
65
|
-
).then(() => {
|
|
66
|
-
console.info(`Updated ${filePath}`);
|
|
67
|
-
}).catch((e) => {
|
|
68
|
-
console.error(`Failed to update ${filePath}:`, e);
|
|
69
|
-
})
|
|
70
|
-
);
|
|
71
|
-
} catch (error) {
|
|
72
|
-
console.error(`Failed to process ${filePath}:`, error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
await Promise.all(filePromises);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
27
|
+
return {
|
|
28
|
+
name: "remove-unused-translations",
|
|
29
|
+
transform(code) {
|
|
30
|
+
for (const key of translationKeys) if (code.includes(key) && !used.has(key)) {
|
|
31
|
+
console.info(`Found key: ${key}`);
|
|
32
|
+
used.add(key);
|
|
33
|
+
}
|
|
34
|
+
return { code };
|
|
35
|
+
},
|
|
36
|
+
enforce: "post",
|
|
37
|
+
async writeBundle() {
|
|
38
|
+
const jsonFiles = await (0, fast_glob.default)(jsonPattern, { absolute: true });
|
|
39
|
+
console.info(`Found ${jsonFiles.length} JSON files at ${jsonPattern}`);
|
|
40
|
+
const filePromises = [];
|
|
41
|
+
for (const filePath of jsonFiles) try {
|
|
42
|
+
const content = await node_fs_promises.default.readFile(filePath, "utf-8");
|
|
43
|
+
const jsonDataFlattened = flatten(JSON.parse(content));
|
|
44
|
+
const unflattened = unflatten(Object.fromEntries(Object.entries(jsonDataFlattened).filter(([key]) => used.has(key))));
|
|
45
|
+
filePromises.push(node_fs_promises.default.writeFile(filePath, JSON.stringify(unflattened, null, 2), "utf-8").then(() => {
|
|
46
|
+
console.info(`Updated ${filePath}`);
|
|
47
|
+
}).catch((e) => {
|
|
48
|
+
console.error(`Failed to update ${filePath}:`, e);
|
|
49
|
+
}));
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(`Failed to process ${filePath}:`, error);
|
|
52
|
+
}
|
|
53
|
+
await Promise.all(filePromises);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
78
56
|
}
|
|
57
|
+
//#endregion
|
|
79
58
|
exports.default = VitePluginRemoveUnusedTranslations;
|
|
80
59
|
exports.flatten = flatten;
|
|
81
60
|
exports.unflatten = unflatten;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/vite/vite-plugin-sourcemap-exclude.ts
|
|
2
2
|
function VitePluginSourcemapExclude(opts) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
3
|
+
return {
|
|
4
|
+
name: "sourcemap-exclude",
|
|
5
|
+
transform(code, id) {
|
|
6
|
+
if (opts?.excludeNodeModules && id.includes("node_modules")) return {
|
|
7
|
+
code,
|
|
8
|
+
map: { mappings: "" }
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
};
|
|
16
12
|
}
|
|
17
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.default = VitePluginSourcemapExclude;
|