@prosopo/config 3.1.0 → 3.1.1

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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/index.cjs +4 -38
  3. package/dist/cjs/vite/index.cjs +4 -0
  4. package/dist/cjs/vite/vite-plugin-copy.cjs +42 -0
  5. package/dist/cjs/vite/vite-plugin-remove-unused-translations.cjs +2 -2
  6. package/dist/cjs/vite/vite.commonjs.config.cjs +7 -1
  7. package/dist/cjs/vite/vite.esm.config.cjs +54 -0
  8. package/dist/cjs/vite/vite.test.config.cjs +14 -2
  9. package/dist/dependencies.js +134 -112
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +31 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/vite/TsNoCheckPlugin.js +17 -13
  15. package/dist/vite/index.d.ts +2 -0
  16. package/dist/vite/index.d.ts.map +1 -1
  17. package/dist/vite/index.js +24 -10
  18. package/dist/vite/index.js.map +1 -1
  19. package/dist/vite/vite-plugin-close-and-copy.js +41 -36
  20. package/dist/vite/vite-plugin-copy.d.ts +10 -0
  21. package/dist/vite/vite-plugin-copy.d.ts.map +1 -0
  22. package/dist/vite/vite-plugin-copy.js +43 -0
  23. package/dist/vite/vite-plugin-copy.js.map +1 -0
  24. package/dist/vite/vite-plugin-fix-absolute-imports.js +25 -20
  25. package/dist/vite/vite-plugin-remove-unused-translations.js +76 -70
  26. package/dist/vite/vite-plugin-sourcemap-exclude.js +17 -14
  27. package/dist/vite/vite.backend.config.js +90 -84
  28. package/dist/vite/vite.commonjs.config.d.ts.map +1 -1
  29. package/dist/vite/vite.commonjs.config.js +53 -41
  30. package/dist/vite/vite.commonjs.config.js.map +1 -1
  31. package/dist/vite/vite.esm.config.d.ts +3 -0
  32. package/dist/vite/vite.esm.config.d.ts.map +1 -0
  33. package/dist/vite/vite.esm.config.js +55 -0
  34. package/dist/vite/vite.esm.config.js.map +1 -0
  35. package/dist/vite/vite.frontend.config.js +171 -141
  36. package/dist/vite/vite.test.config.d.ts +1 -1
  37. package/dist/vite/vite.test.config.d.ts.map +1 -1
  38. package/dist/vite/vite.test.config.js +58 -42
  39. package/dist/vite/vite.test.config.js.map +1 -1
  40. package/dist/webpack/index.js +1 -2
  41. package/dist/webpack/webpack.config.js +115 -109
  42. package/package.json +26 -21
  43. package/vite.cjs.config.ts +3 -4
  44. package/vite.esm.config.ts +19 -0
  45. package/dist/cjs/projectInfo.cjs +0 -76
  46. package/dist/projectInfo.d.ts +0 -38
  47. package/dist/projectInfo.d.ts.map +0 -1
  48. package/dist/projectInfo.js +0 -38
  49. package/dist/projectInfo.js.map +0 -1
@@ -1,10 +1,24 @@
1
- export { default as VitePluginCloseAndCopy } from "./vite-plugin-close-and-copy.js";
2
- export { default as ViteTestConfig } from "./vite.test.config.js";
3
- export { default as VitePluginSourceMapExclude } from "./vite-plugin-sourcemap-exclude.js";
4
- export { default as ViteFrontendConfig } from "./vite.frontend.config.js";
5
- export { default as ViteBackendConfig } from "./vite.backend.config.js";
6
- export { default as VitePluginFixAbsoluteImports } from "./vite-plugin-fix-absolute-imports.js";
7
- export { default as ViteCommonJSConfig } from "./vite.commonjs.config.js";
8
- export { default as VitePluginRemoveUnusedTranslations } from "./vite-plugin-remove-unused-translations.js";
9
- export * from "./TsNoCheckPlugin.js";
10
- //# sourceMappingURL=index.js.map
1
+ import { default as default2 } from "./vite-plugin-close-and-copy.js";
2
+ import { default as default3 } from "./vite.test.config.js";
3
+ import { default as default4 } from "./vite-plugin-sourcemap-exclude.js";
4
+ import { default as default5 } from "./vite.frontend.config.js";
5
+ import { default as default6 } from "./vite.backend.config.js";
6
+ import { default as default7 } from "./vite-plugin-fix-absolute-imports.js";
7
+ import { default as default8 } from "./vite.commonjs.config.js";
8
+ import { default as default9 } from "./vite.esm.config.js";
9
+ import { default as default10 } from "./vite-plugin-remove-unused-translations.js";
10
+ import { tsNoCheckPlugin } from "./TsNoCheckPlugin.js";
11
+ import { default as default11 } from "./vite-plugin-copy.js";
12
+ export {
13
+ default6 as ViteBackendConfig,
14
+ default8 as ViteCommonJSConfig,
15
+ default9 as ViteEsmConfig,
16
+ default5 as ViteFrontendConfig,
17
+ default2 as VitePluginCloseAndCopy,
18
+ default11 as VitePluginCopy,
19
+ default7 as VitePluginFixAbsoluteImports,
20
+ default10 as VitePluginRemoveUnusedTranslations,
21
+ default4 as VitePluginSourceMapExclude,
22
+ default3 as ViteTestConfig,
23
+ tsNoCheckPlugin
24
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAC5G,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAC5G,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,42 +1,47 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- export default function VitePluginCloseAndCopy(options) {
4
- const __dirname = path.resolve();
5
- return {
6
- name: "close-plugin",
7
- buildStart() {
8
- console.info("Bundle build started");
9
- },
10
- buildEnd(error) {
11
- console.info("Build end");
12
- if (error) {
13
- console.log(error);
14
- console.error(error);
15
- }
16
- },
17
- closeBundle() {
18
- if (options) {
19
- for (const destDir of options.destDir) {
20
- clearOutputDirJS(__dirname, destDir);
21
- console.info(`Bundle cleared from ${options.destDir}`);
22
- copyBundle(__dirname, options.srcDir, destDir);
23
- console.info(`Bundle copied to ${options.destDir}`);
24
- }
25
- console.info("Bundle closed");
26
- }
27
- },
28
- };
3
+ function VitePluginCloseAndCopy(options) {
4
+ const __dirname = path.resolve();
5
+ return {
6
+ name: "close-plugin",
7
+ // required, will show up in warnings and errors
8
+ buildStart() {
9
+ console.info("Bundle build started");
10
+ },
11
+ buildEnd(error) {
12
+ console.info("Build end");
13
+ if (error) {
14
+ console.log(error);
15
+ console.error(error);
16
+ }
17
+ },
18
+ closeBundle() {
19
+ if (options) {
20
+ for (const destDir of options.destDir) {
21
+ clearOutputDirJS(__dirname, destDir);
22
+ console.info(`Bundle cleared from ${options.destDir}`);
23
+ copyBundle(__dirname, options.srcDir, destDir);
24
+ console.info(`Bundle copied to ${options.destDir}`);
25
+ }
26
+ console.info("Bundle closed");
27
+ }
28
+ }
29
+ };
29
30
  }
30
- const clearOutputDirJS = (__dirname, destDir) => fs
31
- .readdirSync(path.resolve(__dirname, destDir))
32
- .filter((file) => file.endsWith("js"))
33
- .map((file) => {
34
- fs.rmSync(path.resolve(__dirname, destDir, file));
31
+ const clearOutputDirJS = (__dirname, destDir) => fs.readdirSync(path.resolve(__dirname, destDir)).filter((file) => file.endsWith("js")).map((file) => {
32
+ fs.rmSync(path.resolve(__dirname, destDir, file));
35
33
  });
36
34
  const copyBundle = (__dirname, srcDir, destDir) => {
37
- console.info("Copying", path.resolve(__dirname, srcDir), "to", path.resolve(__dirname, destDir));
38
- fs.cpSync(path.resolve(__dirname, srcDir), path.resolve(__dirname, destDir), {
39
- recursive: true,
40
- });
35
+ console.info(
36
+ "Copying",
37
+ path.resolve(__dirname, srcDir),
38
+ "to",
39
+ path.resolve(__dirname, destDir)
40
+ );
41
+ fs.cpSync(path.resolve(__dirname, srcDir), path.resolve(__dirname, destDir), {
42
+ recursive: true
43
+ });
44
+ };
45
+ export {
46
+ VitePluginCloseAndCopy as default
41
47
  };
42
- //# sourceMappingURL=vite-plugin-close-and-copy.js.map
@@ -0,0 +1,10 @@
1
+ import type { Plugin } from "vite";
2
+ interface CopyPluginOptions {
3
+ srcDir: string;
4
+ destDir: string;
5
+ include?: string[];
6
+ exclude?: string[];
7
+ }
8
+ export default function VitePluginCopy(options: CopyPluginOptions): Plugin;
9
+ export {};
10
+ //# sourceMappingURL=vite-plugin-copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-copy.d.ts","sourceRoot":"","sources":["../../src/vite/vite-plugin-copy.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,UAAU,iBAAiB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AASD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAiCzE"}
@@ -0,0 +1,43 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import fg from "fast-glob";
4
+ function ensureDirExists(filePath) {
5
+ const dir = path.dirname(filePath);
6
+ if (!fs.existsSync(dir)) {
7
+ fs.mkdirSync(dir, { recursive: true });
8
+ }
9
+ }
10
+ function VitePluginCopy(options) {
11
+ const __dirname = path.resolve();
12
+ return {
13
+ name: "copy-plugin",
14
+ async closeBundle() {
15
+ const srcAbs = path.resolve(__dirname, options.srcDir);
16
+ const destAbs = path.resolve(__dirname, options.destDir);
17
+ const include = options.include && options.include.length > 0 ? options.include : void 0;
18
+ const exclude = options.exclude || [];
19
+ if (!include) {
20
+ console.info(
21
+ "[copy-plugin] No include globs specified, nothing to copy."
22
+ );
23
+ return;
24
+ }
25
+ const files = await fg(include, {
26
+ cwd: srcAbs,
27
+ ignore: exclude,
28
+ onlyFiles: true,
29
+ absolute: false
30
+ });
31
+ for (const relFile of files) {
32
+ const srcFile = path.join(srcAbs, relFile);
33
+ const destFile = path.join(destAbs, relFile);
34
+ ensureDirExists(destFile);
35
+ console.info(`[copy-plugin] copying ${srcFile} to ${destFile}`);
36
+ fs.copyFileSync(srcFile, destFile);
37
+ }
38
+ }
39
+ };
40
+ }
41
+ export {
42
+ VitePluginCopy as default
43
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-copy.js","sourceRoot":"","sources":["../../src/vite/vite-plugin-copy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,WAAW,CAAC;AAU3B,SAAS,eAAe,CAAC,QAAgB;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;AACF,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,OAA0B;IAChE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IACjC,OAAO;QACN,IAAI,EAAE,aAAa;QACnB,KAAK,CAAC,WAAW;YAChB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACzD,MAAM,OAAO,GACZ,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAC5C,CAAC,CAAC,OAAO,CAAC,OAAO;gBACjB,CAAC,CAAC,SAAS,CAAC;YACd,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;YACtC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CACX,4DAA4D,CAC5D,CAAC;gBACF,OAAO;YACR,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,EAAE;gBAC/B,GAAG,EAAE,MAAM;gBACX,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;YACH,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;gBAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC7C,eAAe,CAAC,QAAQ,CAAC,CAAC;gBAC1B,OAAO,CAAC,IAAI,CAAC,yBAAyB,OAAO,OAAO,QAAQ,EAAE,CAAC,CAAC;gBAChE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACpC,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,22 +1,27 @@
1
1
  import { builtinModules } from "node:module";
2
- export default function VitePluginFixAbsoluteImports() {
3
- return {
4
- name: "fix-absolute-imports",
5
- transform(code, id) {
6
- for (const module of builtinModules) {
7
- const moduleImportRegex = new RegExp(`from "(${module}(/.*)*/.*.js)";`, "g");
8
- const matches = code.match(moduleImportRegex);
9
- if (matches) {
10
- for (const match of matches) {
11
- code = code.replace(match, `from "${module}";`);
12
- }
13
- }
14
- }
15
- return {
16
- code,
17
- };
18
- },
19
- enforce: "post",
20
- };
2
+ function VitePluginFixAbsoluteImports() {
3
+ return {
4
+ name: "fix-absolute-imports",
5
+ transform(code, id) {
6
+ for (const module of builtinModules) {
7
+ const moduleImportRegex = new RegExp(
8
+ `from "(${module}(/.*)*/.*.js)";`,
9
+ "g"
10
+ );
11
+ const matches = code.match(moduleImportRegex);
12
+ if (matches) {
13
+ for (const match of matches) {
14
+ code = code.replace(match, `from "${module}";`);
15
+ }
16
+ }
17
+ }
18
+ return {
19
+ code
20
+ };
21
+ },
22
+ enforce: "post"
23
+ };
21
24
  }
22
- //# sourceMappingURL=vite-plugin-fix-absolute-imports.js.map
25
+ export {
26
+ VitePluginFixAbsoluteImports as default
27
+ };
@@ -1,75 +1,81 @@
1
1
  import fs from "node:fs/promises";
2
- import glob from "fast-glob";
3
- const used = new Set();
4
- export const flatten = (obj, prefix = "") => {
5
- const flattenedObj = {};
6
- for (const [key, value] of Object.entries(obj)) {
7
- if (value instanceof Object) {
8
- Object.assign(flattenedObj, flatten(value, `${prefix + key}.`));
9
- }
10
- else {
11
- flattenedObj[prefix + key] = value;
12
- }
2
+ import fg from "fast-glob";
3
+ const used = /* @__PURE__ */ new Set();
4
+ const flatten = (obj, prefix = "") => {
5
+ const flattenedObj = {};
6
+ for (const [key, value] of Object.entries(obj)) {
7
+ if (value instanceof Object) {
8
+ Object.assign(flattenedObj, flatten(value, `${prefix + key}.`));
9
+ } else {
10
+ flattenedObj[prefix + key] = value;
13
11
  }
14
- return flattenedObj;
12
+ }
13
+ return flattenedObj;
15
14
  };
16
- export const unflatten = (obj) => {
17
- const result = {};
18
- for (const [key, value] of Object.entries(obj)) {
19
- const keys = key.split(".");
20
- keys.reduce((acc, k, i) => {
21
- if (i === keys.length - 1) {
22
- acc[k] = value;
23
- }
24
- else {
25
- if (!acc[k]) {
26
- acc[k] = Number.isNaN(Number(keys[i + 1])) ? {} : [];
27
- }
28
- }
29
- return acc[k];
30
- }, result);
31
- }
32
- return result;
15
+ const unflatten = (obj) => {
16
+ const result = {};
17
+ for (const [key, value] of Object.entries(obj)) {
18
+ const keys = key.split(".");
19
+ keys.reduce((acc, k, i) => {
20
+ if (i === keys.length - 1) {
21
+ acc[k] = value;
22
+ } else {
23
+ if (!acc[k]) {
24
+ acc[k] = Number.isNaN(Number(keys[i + 1])) ? {} : [];
25
+ }
26
+ }
27
+ return acc[k];
28
+ }, result);
29
+ }
30
+ return result;
33
31
  };
34
- export default function VitePluginRemoveUnusedTranslations(translationKeys, jsonPattern) {
35
- return {
36
- name: "remove-unused-translations",
37
- transform(code) {
38
- for (const key of translationKeys) {
39
- if (code.includes(key) && !used.has(key)) {
40
- console.info(`Found key: ${key}`);
41
- used.add(key);
42
- }
43
- }
44
- return { code };
45
- },
46
- enforce: "post",
47
- async writeBundle() {
48
- const jsonFiles = await glob(jsonPattern, { absolute: true });
49
- console.info(`Found ${jsonFiles.length} JSON files at ${jsonPattern}`);
50
- const filePromises = [];
51
- for (const filePath of jsonFiles) {
52
- try {
53
- const content = await fs.readFile(filePath, "utf-8");
54
- const jsonData = JSON.parse(content);
55
- const jsonDataFlattened = flatten(jsonData);
56
- const filteredData = Object.fromEntries(Object.entries(jsonDataFlattened).filter(([key]) => used.has(key)));
57
- const unflattened = unflatten(filteredData);
58
- filePromises.push(fs
59
- .writeFile(filePath, JSON.stringify(unflattened, null, 2), "utf-8")
60
- .then(() => {
61
- console.info(`Updated ${filePath}`);
62
- })
63
- .catch((e) => {
64
- console.error(`Failed to update ${filePath}:`, e);
65
- }));
66
- }
67
- catch (error) {
68
- console.error(`Failed to process ${filePath}:`, error);
69
- }
70
- }
71
- await Promise.all(filePromises);
72
- },
73
- };
32
+ function VitePluginRemoveUnusedTranslations(translationKeys, jsonPattern) {
33
+ return {
34
+ name: "remove-unused-translations",
35
+ transform(code) {
36
+ for (const key of translationKeys) {
37
+ if (code.includes(key) && !used.has(key)) {
38
+ console.info(`Found key: ${key}`);
39
+ used.add(key);
40
+ }
41
+ }
42
+ return { code };
43
+ },
44
+ enforce: "post",
45
+ async writeBundle() {
46
+ const jsonFiles = await fg(jsonPattern, { absolute: true });
47
+ console.info(`Found ${jsonFiles.length} JSON files at ${jsonPattern}`);
48
+ const filePromises = [];
49
+ for (const filePath of jsonFiles) {
50
+ try {
51
+ const content = await fs.readFile(filePath, "utf-8");
52
+ const jsonData = JSON.parse(content);
53
+ const jsonDataFlattened = flatten(jsonData);
54
+ const filteredData = Object.fromEntries(
55
+ Object.entries(jsonDataFlattened).filter(([key]) => used.has(key))
56
+ );
57
+ const unflattened = unflatten(filteredData);
58
+ filePromises.push(
59
+ fs.writeFile(
60
+ filePath,
61
+ JSON.stringify(unflattened, null, 2),
62
+ "utf-8"
63
+ ).then(() => {
64
+ console.info(`Updated ${filePath}`);
65
+ }).catch((e) => {
66
+ console.error(`Failed to update ${filePath}:`, e);
67
+ })
68
+ );
69
+ } catch (error) {
70
+ console.error(`Failed to process ${filePath}:`, error);
71
+ }
72
+ }
73
+ await Promise.all(filePromises);
74
+ }
75
+ };
74
76
  }
75
- //# sourceMappingURL=vite-plugin-remove-unused-translations.js.map
77
+ export {
78
+ VitePluginRemoveUnusedTranslations as default,
79
+ flatten,
80
+ unflatten
81
+ };
@@ -1,15 +1,18 @@
1
- export default function VitePluginSourcemapExclude(opts) {
2
- return {
3
- name: "sourcemap-exclude",
4
- transform(code, id) {
5
- if (opts?.excludeNodeModules && id.includes("node_modules")) {
6
- return {
7
- code,
8
- map: { mappings: "" },
9
- };
10
- }
11
- return;
12
- },
13
- };
1
+ function VitePluginSourcemapExclude(opts) {
2
+ return {
3
+ name: "sourcemap-exclude",
4
+ transform(code, id) {
5
+ if (opts?.excludeNodeModules && id.includes("node_modules")) {
6
+ return {
7
+ code,
8
+ // https://github.com/rollup/rollup/blob/master/docs/plugin-development/index.md#source-code-transformations
9
+ map: { mappings: "" }
10
+ };
11
+ }
12
+ return;
13
+ }
14
+ };
14
15
  }
15
- //# sourceMappingURL=vite-plugin-sourcemap-exclude.js.map
16
+ export {
17
+ VitePluginSourcemapExclude as default
18
+ };
@@ -3,91 +3,97 @@ import path from "node:path";
3
3
  import { nodeResolve } from "@rollup/plugin-node-resolve";
4
4
  import { wasm } from "@rollup/plugin-wasm";
5
5
  import css from "rollup-plugin-import-css";
6
- import { filterDependencies, getDependencies } from "../dependencies.js";
7
- import { default as ClosePlugin } from "./vite-plugin-close-and-copy.js";
6
+ import { getDependencies, filterDependencies } from "../dependencies.js";
7
+ import VitePluginCloseAndCopy from "./vite-plugin-close-and-copy.js";
8
8
  import VitePluginFixAbsoluteImports from "./vite-plugin-fix-absolute-imports.js";
9
- export default async function (packageName, packageVersion, bundleName, packageDir, entry, command, mode, outputDir) {
10
- const isProduction = mode === "production";
11
- const { dependencies: deps, optionalPeerDependencies } = await getDependencies(packageName, true);
12
- const outDir = outputDir
13
- ? path.resolve(outputDir)
14
- : path.resolve(packageDir, "dist/bundle");
15
- const { external, internal } = filterDependencies(deps, [
16
- "aws",
17
- "webpack",
18
- "vite",
19
- "biome",
20
- ]);
21
- const allExternal = [
22
- ...builtinModules,
23
- ...builtinModules.map((m) => `node:${m}`),
24
- ...external,
25
- ...optionalPeerDependencies,
26
- ];
27
- console.info(`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`);
28
- const define = {
29
- "process.env.WS_NO_BUFFER_UTIL": "true",
30
- "process.env.WS_NO_UTF_8_VALIDATE": "true",
31
- "process.env.PROSOPO_PACKAGE_VERSION": JSON.stringify(packageVersion),
32
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || mode),
33
- ...(process.env.PROSOPO_DEFAULT_ENVIRONMENT && {
34
- "process.env.PROSOPO_DEFAULT_ENVIRONMENT": JSON.stringify(process.env.PROSOPO_DEFAULT_ENVIRONMENT),
35
- }),
36
- };
37
- console.info(`Defined vars ${JSON.stringify(define, null, 2)}`);
38
- let entriesAbsolute;
39
- if (typeof entry === "string") {
40
- entriesAbsolute = [path.resolve(packageDir, entry)];
9
+ async function vite_backend_config(packageName, packageVersion, bundleName, packageDir, entry, command, mode, outputDir) {
10
+ const isProduction = mode === "production";
11
+ const { dependencies: deps, optionalPeerDependencies } = await getDependencies(packageName, true);
12
+ const outDir = outputDir ? path.resolve(outputDir) : path.resolve(packageDir, "dist/bundle");
13
+ const { external, internal } = filterDependencies(deps, [
14
+ "aws",
15
+ "webpack",
16
+ "vite",
17
+ "biome"
18
+ ]);
19
+ const allExternal = [
20
+ ...builtinModules,
21
+ ...builtinModules.map((m) => `node:${m}`),
22
+ ...external,
23
+ ...optionalPeerDependencies
24
+ ];
25
+ console.info(
26
+ `Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`
27
+ );
28
+ const define = {
29
+ "process.env.WS_NO_BUFFER_UTIL": "true",
30
+ "process.env.WS_NO_UTF_8_VALIDATE": "true",
31
+ "process.env.PROSOPO_PACKAGE_VERSION": JSON.stringify(packageVersion),
32
+ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || mode),
33
+ ...process.env.PROSOPO_DEFAULT_ENVIRONMENT && {
34
+ "process.env.PROSOPO_DEFAULT_ENVIRONMENT": JSON.stringify(
35
+ process.env.PROSOPO_DEFAULT_ENVIRONMENT
36
+ )
41
37
  }
42
- else {
43
- entriesAbsolute = entry.map((e) => path.resolve(packageDir, e));
44
- }
45
- const drop = mode === "production" ? ["console", "debugger"] : undefined;
46
- return {
47
- ssr: {
48
- noExternal: internal,
49
- external: allExternal,
50
- },
51
- optimizeDeps: {
52
- include: ["linked-dep", "node_modules"],
53
- esbuildOptions: {
54
- loader: {
55
- ".node": "file",
56
- },
57
- },
58
- },
59
- esbuild: {
60
- platform: "node",
61
- target: "node18",
62
- legalComments: "none",
63
- },
64
- define,
65
- build: {
66
- outDir,
67
- minify: isProduction,
68
- ssr: true,
69
- target: "node18",
70
- lib: {
71
- entry: entriesAbsolute,
72
- name: bundleName,
73
- fileName: `${bundleName}.[name].bundle.js`,
74
- formats: ["es"],
75
- },
76
- modulePreload: { polyfill: false },
77
- rollupOptions: {
78
- treeshake: "smallest",
79
- external: allExternal,
80
- watch: false,
81
- output: {
82
- entryFileNames: `${bundleName}.[name].bundle.js`,
83
- },
84
- plugins: [css(), wasm(), nodeResolve()],
85
- },
38
+ };
39
+ console.info(`Defined vars ${JSON.stringify(define, null, 2)}`);
40
+ let entriesAbsolute;
41
+ if (typeof entry === "string") {
42
+ entriesAbsolute = [path.resolve(packageDir, entry)];
43
+ } else {
44
+ entriesAbsolute = entry.map((e) => path.resolve(packageDir, e));
45
+ }
46
+ const drop = mode === "production" ? ["console", "debugger"] : void 0;
47
+ return {
48
+ ssr: {
49
+ noExternal: internal,
50
+ external: allExternal
51
+ },
52
+ optimizeDeps: {
53
+ include: ["linked-dep", "node_modules"],
54
+ esbuildOptions: {
55
+ loader: {
56
+ ".node": "file"
57
+ }
58
+ }
59
+ },
60
+ esbuild: {
61
+ platform: "node",
62
+ target: "node18",
63
+ // drop,
64
+ legalComments: "none"
65
+ },
66
+ define,
67
+ build: {
68
+ outDir,
69
+ minify: isProduction,
70
+ ssr: true,
71
+ target: "node18",
72
+ lib: {
73
+ entry: entriesAbsolute,
74
+ name: bundleName,
75
+ fileName: `${bundleName}.[name].bundle.js`,
76
+ formats: ["es"]
77
+ },
78
+ modulePreload: { polyfill: false },
79
+ rollupOptions: {
80
+ treeshake: "smallest",
81
+ external: allExternal,
82
+ watch: false,
83
+ output: {
84
+ entryFileNames: `${bundleName}.[name].bundle.js`
86
85
  },
87
- plugins: [
88
- VitePluginFixAbsoluteImports(),
89
- command !== "serve" ? ClosePlugin() : undefined,
90
- ],
91
- };
86
+ plugins: [css(), wasm(), nodeResolve()]
87
+ }
88
+ },
89
+ plugins: [
90
+ // plugin to replace stuff like import blah from string_encoder/lib/string_encoder.js with import blah from string_encoder
91
+ VitePluginFixAbsoluteImports(),
92
+ // plugin to close the bundle after build if not in serve mode
93
+ command !== "serve" ? VitePluginCloseAndCopy() : void 0
94
+ ]
95
+ };
92
96
  }
93
- //# sourceMappingURL=vite.backend.config.js.map
97
+ export {
98
+ vite_backend_config as default
99
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"vite.commonjs.config.d.ts","sourceRoot":"","sources":["../../src/vite/vite.commonjs.config.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,MAAM,CAAC;AAMrD,yBACC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAyCrB"}
1
+ {"version":3,"file":"vite.commonjs.config.d.ts","sourceRoot":"","sources":["../../src/vite/vite.commonjs.config.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,MAAM,CAAC;AAOrD,yBACC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CA8CrB"}