@prosopo/config 2.5.5 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/cjs/dependencies.cjs +155 -0
- package/dist/cjs/index.cjs +65 -0
- package/dist/cjs/projectInfo.cjs +76 -0
- package/dist/cjs/vite/TsNoCheckPlugin.cjs +18 -0
- package/dist/cjs/vite/index.cjs +20 -0
- package/dist/cjs/vite/vite-plugin-close-and-copy.cjs +46 -0
- package/dist/cjs/vite/vite-plugin-fix-absolute-imports.cjs +26 -0
- package/dist/cjs/vite/vite-plugin-remove-unused-translations.cjs +81 -0
- package/dist/cjs/vite/vite-plugin-sourcemap-exclude.cjs +17 -0
- package/dist/cjs/vite/vite.backend.config.cjs +98 -0
- package/dist/cjs/vite/vite.commonjs.config.cjs +54 -0
- package/dist/cjs/vite/vite.frontend.config.cjs +182 -0
- package/dist/cjs/vite/vite.test.config.cjs +47 -0
- package/dist/cjs/webpack/index.cjs +2 -0
- package/dist/cjs/webpack/webpack.config.cjs +149 -0
- package/dist/dependencies.d.ts.map +1 -1
- package/dist/dependencies.js +10 -15
- package/dist/dependencies.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/vite/NodejsPolarsDirnamePlugin.d.ts +1 -2
- package/dist/vite/NodejsPolarsDirnamePlugin.d.ts.map +1 -1
- package/dist/vite/NodejsPolarsDirnamePlugin.js +3 -3
- package/dist/vite/NodejsPolarsDirnamePlugin.js.map +1 -1
- package/dist/vite/NodejsPolarsNativeFilePlugin.d.ts +1 -2
- package/dist/vite/NodejsPolarsNativeFilePlugin.d.ts.map +1 -1
- package/dist/vite/NodejsPolarsNativeFilePlugin.js +5 -5
- package/dist/vite/NodejsPolarsNativeFilePlugin.js.map +1 -1
- package/dist/vite/vite-plugin-close-and-copy.d.ts.map +1 -1
- package/dist/vite/vite-plugin-close-and-copy.js +7 -9
- package/dist/vite/vite-plugin-close-and-copy.js.map +1 -1
- package/dist/vite/vite-plugin-remove-unused-translations.d.ts +4 -0
- package/dist/vite/vite-plugin-remove-unused-translations.d.ts.map +1 -1
- package/dist/vite/vite-plugin-remove-unused-translations.js +35 -8
- package/dist/vite/vite-plugin-remove-unused-translations.js.map +1 -1
- package/dist/vite/vite.backend.config.d.ts +1 -1
- package/dist/vite/vite.backend.config.d.ts.map +1 -1
- package/dist/vite/vite.backend.config.js +14 -9
- 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 +1 -3
- package/dist/vite/vite.commonjs.config.js.map +1 -1
- package/dist/vite/vite.frontend.config.d.ts.map +1 -1
- package/dist/vite/vite.frontend.config.js +10 -7
- 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 +0 -6
- package/dist/vite/vite.test.config.js.map +1 -1
- package/package.json +13 -12
- package/dist/provider/index.d.ts +0 -2
- package/dist/provider/index.d.ts.map +0 -1
- package/dist/provider/index.js +0 -2
- package/dist/provider/index.js.map +0 -1
- package/dist/provider/test.d.ts +0 -101
- package/dist/provider/test.d.ts.map +0 -1
- package/dist/provider/test.js +0 -27
- package/dist/provider/test.js.map +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const node_module = require("node:module");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const replace = require("@rollup/plugin-replace");
|
|
5
|
+
const vite = require("vite");
|
|
6
|
+
const noBundlePlugin = require("vite-plugin-no-bundle");
|
|
7
|
+
const tsconfigPaths = require("vite-tsconfig-paths");
|
|
8
|
+
const dependencies = require("../dependencies.cjs");
|
|
9
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
10
|
+
async function vite_commonjs_config(name, tsConfigPath, entry) {
|
|
11
|
+
console.info(`ViteCommonJSConfig: ${name}`);
|
|
12
|
+
const projectExternal = await dependencies.getExternalsFromReferences(tsConfigPath, [
|
|
13
|
+
/dev/
|
|
14
|
+
]);
|
|
15
|
+
const allExternal = [
|
|
16
|
+
...node_module.builtinModules,
|
|
17
|
+
...node_module.builtinModules.map((m) => `node:${m}`),
|
|
18
|
+
...projectExternal
|
|
19
|
+
];
|
|
20
|
+
return vite.defineConfig({
|
|
21
|
+
ssr: { external: allExternal },
|
|
22
|
+
plugins: [
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
replace({
|
|
25
|
+
"module": "module"
|
|
26
|
+
// Replaces ESM checks with CommonJS equivalent
|
|
27
|
+
}),
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
noBundlePlugin({
|
|
30
|
+
root: "src",
|
|
31
|
+
copy: "**/*.css"
|
|
32
|
+
}),
|
|
33
|
+
tsconfigPaths({ projects: [path.resolve(tsConfigPath)] }),
|
|
34
|
+
vitePluginCloseAndCopy()
|
|
35
|
+
],
|
|
36
|
+
build: {
|
|
37
|
+
emptyOutDir: true,
|
|
38
|
+
ssr: true,
|
|
39
|
+
target: "node18",
|
|
40
|
+
outDir: "dist/cjs",
|
|
41
|
+
lib: {
|
|
42
|
+
name,
|
|
43
|
+
formats: ["cjs"],
|
|
44
|
+
entry: entry || "src/index.ts"
|
|
45
|
+
// required
|
|
46
|
+
},
|
|
47
|
+
rollupOptions: {
|
|
48
|
+
treeshake: false,
|
|
49
|
+
external: allExternal
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
module.exports = vite_commonjs_config;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const node_module = require("node:module");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const nodeResolve = require("@rollup/plugin-node-resolve");
|
|
5
|
+
const typescript = require("@rollup/plugin-typescript");
|
|
6
|
+
const pluginWasm = require("@rollup/plugin-wasm");
|
|
7
|
+
const viteReact = require("@vitejs/plugin-react");
|
|
8
|
+
const css = require("rollup-plugin-import-css");
|
|
9
|
+
const rollupPluginVisualizer = require("rollup-plugin-visualizer");
|
|
10
|
+
const vitePluginNodePolyfills = require("vite-plugin-node-polyfills");
|
|
11
|
+
const dependencies = require("../dependencies.cjs");
|
|
12
|
+
require("./index.cjs");
|
|
13
|
+
const vitePluginCloseAndCopy = require("./vite-plugin-close-and-copy.cjs");
|
|
14
|
+
async function vite_frontend_config(packageName, bundleName, dir, entry, command, mode, copyOptions, tsConfigPaths, workspaceRoot) {
|
|
15
|
+
if (mode !== "production") {
|
|
16
|
+
mode = "development";
|
|
17
|
+
}
|
|
18
|
+
const allowedEnvironments = ["development", "staging", "production"];
|
|
19
|
+
const defaultEnvironment = process.env.NODE_ENV && allowedEnvironments.includes(process.env.NODE_ENV) ? process.env.NODE_ENV : mode;
|
|
20
|
+
console.info(`Running at ${dir} in ${mode} mode`);
|
|
21
|
+
const isProduction = mode === "production";
|
|
22
|
+
process.env.NODE_ENV = `${process.env.NODE_ENV || mode}`;
|
|
23
|
+
console.info(`NODE_ENV: ${process.env.NODE_ENV}`);
|
|
24
|
+
const define = {
|
|
25
|
+
// used to stop websockets package from breaking
|
|
26
|
+
"process.env.WS_NO_BUFFER_UTIL": JSON.stringify("true"),
|
|
27
|
+
"process.env.WS_NO_UTF_8_VALIDATE": JSON.stringify("true"),
|
|
28
|
+
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
|
29
|
+
"process.env.PROSOPO_DEFAULT_ENVIRONMENT": JSON.stringify(defaultEnvironment),
|
|
30
|
+
"process.env.PROSOPO_SERVER_URL": JSON.stringify(
|
|
31
|
+
process.env.PROSOPO_SERVER_URL
|
|
32
|
+
),
|
|
33
|
+
"process.env._DEV_ONLY_WATCH_EVENTS": JSON.stringify(
|
|
34
|
+
process.env._DEV_ONLY_WATCH_EVENTS
|
|
35
|
+
),
|
|
36
|
+
"process.env.PROSOPO_MONGO_EVENTS_URI": JSON.stringify(
|
|
37
|
+
process.env.PROSOPO_MONGO_EVENTS_URI
|
|
38
|
+
),
|
|
39
|
+
"process.env.PROSOPO_PACKAGE_VERSION": JSON.stringify(
|
|
40
|
+
process.env.PROSOPO_PACKAGE_VERSION
|
|
41
|
+
),
|
|
42
|
+
"process.env.PROSOPO_DOCS_URL": JSON.stringify(
|
|
43
|
+
process.env.PROSOPO_DOCS_URL
|
|
44
|
+
),
|
|
45
|
+
"process.env.PROSOPO_LOG_LEVEL": JSON.stringify(
|
|
46
|
+
process.env.PROSOPO_LOG_LEVEL
|
|
47
|
+
),
|
|
48
|
+
// only needed if bundling with a site key
|
|
49
|
+
"process.env.PROSOPO_SITE_KEY": JSON.stringify(
|
|
50
|
+
process.env.PROSOPO_SITE_KEY
|
|
51
|
+
)
|
|
52
|
+
};
|
|
53
|
+
console.info(`Env vars: ${JSON.stringify(define, null, 4)}`);
|
|
54
|
+
const { dependencies: deps, optionalPeerDependencies } = await dependencies.getDependencies(packageName, isProduction);
|
|
55
|
+
const { external, internal } = dependencies.filterDependencies(deps, [
|
|
56
|
+
"pm2",
|
|
57
|
+
"nodejs-polars",
|
|
58
|
+
"aws",
|
|
59
|
+
"webpack",
|
|
60
|
+
"vite",
|
|
61
|
+
"i18next-fs-backend"
|
|
62
|
+
]);
|
|
63
|
+
const allExternal = [
|
|
64
|
+
...node_module.builtinModules,
|
|
65
|
+
...node_module.builtinModules.map((m) => `node:${m}`),
|
|
66
|
+
...external,
|
|
67
|
+
...optionalPeerDependencies
|
|
68
|
+
];
|
|
69
|
+
console.debug(
|
|
70
|
+
`Bundling. ${JSON.stringify(internal.slice(0, 10), null, 2)}... ${internal.length} deps`
|
|
71
|
+
);
|
|
72
|
+
const proto = RegExp.prototype;
|
|
73
|
+
proto.toJSON = RegExp.prototype.toString;
|
|
74
|
+
let drop;
|
|
75
|
+
let pure = [];
|
|
76
|
+
if (isProduction) {
|
|
77
|
+
drop = ["debugger"];
|
|
78
|
+
pure = ["console.log", "console.warn", "console.info", "console.debug"];
|
|
79
|
+
}
|
|
80
|
+
const rollupExternal = allExternal;
|
|
81
|
+
console.info({ bundleName }, "Bundle name");
|
|
82
|
+
return {
|
|
83
|
+
server: {
|
|
84
|
+
host: "127.0.0.1"
|
|
85
|
+
},
|
|
86
|
+
mode: mode || "development",
|
|
87
|
+
optimizeDeps: {
|
|
88
|
+
include: ["node_modules"],
|
|
89
|
+
force: true
|
|
90
|
+
},
|
|
91
|
+
esbuild: {
|
|
92
|
+
platform: "browser",
|
|
93
|
+
target: [
|
|
94
|
+
"es2020",
|
|
95
|
+
"chrome60",
|
|
96
|
+
"edge18",
|
|
97
|
+
"firefox60",
|
|
98
|
+
"node22",
|
|
99
|
+
"safari11"
|
|
100
|
+
],
|
|
101
|
+
drop,
|
|
102
|
+
pure,
|
|
103
|
+
legalComments: "none"
|
|
104
|
+
},
|
|
105
|
+
define,
|
|
106
|
+
build: {
|
|
107
|
+
outDir: path.resolve(dir, "dist/bundle"),
|
|
108
|
+
minify: isProduction,
|
|
109
|
+
ssr: false,
|
|
110
|
+
lib: {
|
|
111
|
+
entry: path.resolve(dir, entry),
|
|
112
|
+
name: bundleName,
|
|
113
|
+
fileName: `${bundleName}.bundle.js`,
|
|
114
|
+
formats: ["es"]
|
|
115
|
+
},
|
|
116
|
+
modulePreload: { polyfill: true },
|
|
117
|
+
commonjsOptions: {
|
|
118
|
+
exclude: ["mongodb/*"],
|
|
119
|
+
transformMixedEsModules: true,
|
|
120
|
+
strictRequires: "debug"
|
|
121
|
+
},
|
|
122
|
+
rollupOptions: {
|
|
123
|
+
treeshake: {
|
|
124
|
+
annotations: false,
|
|
125
|
+
propertyReadSideEffects: false,
|
|
126
|
+
tryCatchDeoptimization: false,
|
|
127
|
+
moduleSideEffects: "no-external",
|
|
128
|
+
//true,
|
|
129
|
+
preset: "smallest",
|
|
130
|
+
unknownGlobalSideEffects: false
|
|
131
|
+
},
|
|
132
|
+
experimentalLogSideEffects: false,
|
|
133
|
+
external: rollupExternal,
|
|
134
|
+
watch: false,
|
|
135
|
+
output: {
|
|
136
|
+
dir: path.resolve(dir, "dist/bundle"),
|
|
137
|
+
entryFileNames: `${bundleName}.bundle.js`
|
|
138
|
+
},
|
|
139
|
+
plugins: [
|
|
140
|
+
vitePluginNodePolyfills.nodePolyfills({
|
|
141
|
+
include: ["crypto"]
|
|
142
|
+
}),
|
|
143
|
+
css(),
|
|
144
|
+
pluginWasm.wasm(),
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
nodeResolve({
|
|
147
|
+
browser: true,
|
|
148
|
+
preferBuiltins: false,
|
|
149
|
+
rootDir: path.resolve(dir, "../../"),
|
|
150
|
+
dedupe: ["react", "react-dom"],
|
|
151
|
+
modulesOnly: true
|
|
152
|
+
}),
|
|
153
|
+
rollupPluginVisualizer.visualizer({
|
|
154
|
+
open: true,
|
|
155
|
+
template: "treemap",
|
|
156
|
+
//'list',
|
|
157
|
+
gzipSize: true,
|
|
158
|
+
brotliSize: true
|
|
159
|
+
}),
|
|
160
|
+
// I think we can use this plugin to build all packages instead of relying on the tsc step that's
|
|
161
|
+
// currently a precursor in package.json. However, it fails for the following reason:
|
|
162
|
+
// https://github.com/rollup/plugins/issues/243
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
typescript({
|
|
165
|
+
tsconfig: path.resolve("./tsconfig.json"),
|
|
166
|
+
compilerOptions: { rootDir: path.resolve("./src") },
|
|
167
|
+
outDir: path.resolve(dir, "dist/bundle")
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
plugins: [
|
|
173
|
+
// Not sure if we need this plugin or not, it works without it
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
viteReact(),
|
|
176
|
+
// Closes the bundler and copies the bundle to the client-bundle-example project unless we're in serve
|
|
177
|
+
// mode, in which case we don't want to close the bundler because it will close the server
|
|
178
|
+
command !== "serve" ? vitePluginCloseAndCopy(copyOptions) : void 0
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
module.exports = vite_frontend_config;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const config = require("vitest/config");
|
|
3
|
+
function vite_test_config() {
|
|
4
|
+
const testTypeEnv = process.env.TEST_TYPE || "";
|
|
5
|
+
const testTypes = testTypeEnv.trim().split(",");
|
|
6
|
+
const testTypeGlob = `@(|${testTypes.map((t) => t ? `.${t.trim()}` : "").join("|")})`;
|
|
7
|
+
console.log(`Filtering tests by type: ${testTypeGlob}`);
|
|
8
|
+
return config.defineConfig({
|
|
9
|
+
build: {
|
|
10
|
+
minify: false,
|
|
11
|
+
sourcemap: false,
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
maxParallelFileOps: 1,
|
|
14
|
+
cache: false,
|
|
15
|
+
output: {
|
|
16
|
+
sourcemap: false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
test: {
|
|
21
|
+
//root: getRootDir(),
|
|
22
|
+
reporters: ["basic"],
|
|
23
|
+
include: [
|
|
24
|
+
`src/**/*${testTypeGlob}.@(test|spec).@(mts|cts|mjs|cjs|js|ts|tsx|jsx)`
|
|
25
|
+
],
|
|
26
|
+
watch: false,
|
|
27
|
+
exclude: ["**/node_modules/**", "**/dist/**"],
|
|
28
|
+
logHeapUsage: true,
|
|
29
|
+
coverage: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
include: ["packages/*/src/**"]
|
|
32
|
+
},
|
|
33
|
+
typecheck: {
|
|
34
|
+
enabled: true
|
|
35
|
+
},
|
|
36
|
+
pool: "forks",
|
|
37
|
+
// forks is slower than 'threads' but more compatible with low-level libs (e.g. bcrypt)
|
|
38
|
+
poolOptions: {
|
|
39
|
+
forks: {
|
|
40
|
+
isolate: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
testTimeout: 1e4
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
module.exports = vite_test_config;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
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") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
const fs = require("node:fs");
|
|
25
|
+
const path = require("node:path");
|
|
26
|
+
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
27
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
28
|
+
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
|
|
29
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
30
|
+
const moduleDirs = [path.resolve("./node_modules")];
|
|
31
|
+
function resolveEntryFile() {
|
|
32
|
+
const defaultEntry = "./src/index.tsx";
|
|
33
|
+
const supportedEntries = [defaultEntry, "./src/index.ts"];
|
|
34
|
+
return supportedEntries.find((entry) => fs.existsSync(path.resolve(entry))) || defaultEntry;
|
|
35
|
+
}
|
|
36
|
+
const webpack_config = (mode) => {
|
|
37
|
+
const isProduction = mode === "production";
|
|
38
|
+
const libraryName = "react_app";
|
|
39
|
+
return {
|
|
40
|
+
resolve: {
|
|
41
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".cjs"],
|
|
42
|
+
extensionAlias: {
|
|
43
|
+
".js": [".js", ".jsx", ".ts", ".tsx"]
|
|
44
|
+
},
|
|
45
|
+
modules: moduleDirs,
|
|
46
|
+
fullySpecified: false,
|
|
47
|
+
alias: {
|
|
48
|
+
"@polkadot/x-textdecoder": path.resolve(
|
|
49
|
+
"../../node_modules/@polkadot/util/node_modules/@polkadot/x-textdecoder"
|
|
50
|
+
),
|
|
51
|
+
"@polkadot/x-textencoder": path.resolve(
|
|
52
|
+
"../../node_modules/@polkadot/util/node_modules/@polkadot/x-textencoder"
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
externals: {
|
|
57
|
+
"node:url": "commonjs url",
|
|
58
|
+
url: "commonjs url",
|
|
59
|
+
"node:path": "commonjs path",
|
|
60
|
+
"node:fs": "commonjs fs"
|
|
61
|
+
},
|
|
62
|
+
entry: resolveEntryFile(),
|
|
63
|
+
output: {
|
|
64
|
+
filename: `${libraryName}.[name].bundle.js`,
|
|
65
|
+
path: path.resolve("./dist"),
|
|
66
|
+
publicPath: "/"
|
|
67
|
+
},
|
|
68
|
+
module: {
|
|
69
|
+
rules: [
|
|
70
|
+
// instead of using .babelrc, we can use babel-loader options
|
|
71
|
+
{
|
|
72
|
+
test: /\.(m?js|jsx|tsx|ts)$/,
|
|
73
|
+
exclude: /node_modules/,
|
|
74
|
+
use: {
|
|
75
|
+
loader: "babel-loader",
|
|
76
|
+
options: {
|
|
77
|
+
plugins: [
|
|
78
|
+
"@babel/plugin-transform-runtime",
|
|
79
|
+
"@babel/transform-class-properties",
|
|
80
|
+
"@babel/transform-object-rest-spread",
|
|
81
|
+
"@babel/plugin-transform-react-jsx",
|
|
82
|
+
[
|
|
83
|
+
"@babel/plugin-syntax-import-attributes",
|
|
84
|
+
{ deprecatedAssertSyntax: true }
|
|
85
|
+
]
|
|
86
|
+
],
|
|
87
|
+
presets: ["@babel/preset-env", "@babel/preset-typescript"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
include: /node_modules|src/,
|
|
93
|
+
test: /\.css$/,
|
|
94
|
+
resolve: {
|
|
95
|
+
fullySpecified: false
|
|
96
|
+
},
|
|
97
|
+
sideEffects: true,
|
|
98
|
+
use: [
|
|
99
|
+
MiniCssExtractPlugin.loader,
|
|
100
|
+
{
|
|
101
|
+
loader: require.resolve("css-loader"),
|
|
102
|
+
options: {
|
|
103
|
+
url: false
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
test: /locale\.json$/,
|
|
110
|
+
// match JSON files to optimize
|
|
111
|
+
loader: "webpack-json-access-optimizer"
|
|
112
|
+
},
|
|
113
|
+
// Fix for module
|
|
114
|
+
{
|
|
115
|
+
test: /packageInfo.js$/,
|
|
116
|
+
loader: "string-replace-loader",
|
|
117
|
+
options: {
|
|
118
|
+
search: /import\.meta && import\.meta\.url/g,
|
|
119
|
+
replace: "false"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
plugins: [
|
|
125
|
+
new NodePolyfillPlugin(),
|
|
126
|
+
new HtmlWebpackPlugin({
|
|
127
|
+
template: "./src/index.html"
|
|
128
|
+
}),
|
|
129
|
+
new MiniCssExtractPlugin({
|
|
130
|
+
filename: "extr.[contenthash].css"
|
|
131
|
+
})
|
|
132
|
+
],
|
|
133
|
+
optimization: {
|
|
134
|
+
noEmitOnErrors: true,
|
|
135
|
+
minimize: isProduction,
|
|
136
|
+
minimizer: isProduction ? [
|
|
137
|
+
new TerserPlugin({
|
|
138
|
+
terserOptions: {
|
|
139
|
+
compress: {
|
|
140
|
+
drop_console: true
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
] : [],
|
|
145
|
+
usedExports: true
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
module.exports = webpack_config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAuEA,wBAAgB,YAAY,CAC3B,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,MAAM,EAAO,EAC7B,aAAa,GAAE,MAAM,EAAO,EAC5B,sBAAsB,UAAO,GAC3B,MAAM,EAAE,CA4CV;AAOD,wBAAsB,0BAA0B,CAC/C,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,MAAM,EAAO,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CAmCnB;AAOD,wBAAsB,eAAe,CACpC,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,wBAAwB,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwCzE;AAOD,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,MAAM,EAAE,GACf;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAe5C"}
|
package/dist/dependencies.js
CHANGED
|
@@ -2,9 +2,6 @@ import child_process from "node:child_process";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import util from "node:util";
|
|
5
|
-
import { ProsopoEnvError, getLogger } from "@prosopo/common";
|
|
6
|
-
import { at } from "@prosopo/util";
|
|
7
|
-
const logger = getLogger("Info", "config.dependencies.js");
|
|
8
5
|
const exec = util.promisify(child_process.exec);
|
|
9
6
|
const tsConfigRegex = /\/[A-Za-z.]*\.json$/;
|
|
10
7
|
const peerDepsRegex = /UNMET\sOPTIONAL\sDEPENDENCY\s+(@*[\w\-/.]+)@/;
|
|
@@ -15,12 +12,12 @@ async function getPackageDir(packageName) {
|
|
|
15
12
|
pkg = `@prosopo/${packageName}`;
|
|
16
13
|
}
|
|
17
14
|
const pkgCommand = `npm list ${pkg} -ap`;
|
|
18
|
-
|
|
15
|
+
console.info(`Running command ${pkgCommand}`);
|
|
19
16
|
const { stdout: packageDir, stderr } = await exec(pkgCommand);
|
|
20
17
|
if (stderr) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
if (stderr.includes("ERR!")) {
|
|
19
|
+
throw new Error("CONFIG.INVALID_PACKAGE_DIR");
|
|
20
|
+
}
|
|
24
21
|
}
|
|
25
22
|
return packageDir.trim() || path.resolve();
|
|
26
23
|
}
|
|
@@ -57,7 +54,7 @@ export function getTsConfigs(tsConfigPath, ignorePatterns = [], tsConfigPaths =
|
|
|
57
54
|
}
|
|
58
55
|
export async function getExternalsFromReferences(tsConfigPath, ignorePatterns = []) {
|
|
59
56
|
const tsConfigPaths = getTsConfigs(tsConfigPath, ignorePatterns, [], false);
|
|
60
|
-
|
|
57
|
+
console.debug({ tsConfigPaths });
|
|
61
58
|
const promises = [];
|
|
62
59
|
for (const refTsConfigPath of tsConfigPaths) {
|
|
63
60
|
const packageJsonPath = path.resolve(refTsConfigPath.replace(tsConfigRegex, ""), "package.json");
|
|
@@ -80,7 +77,7 @@ export async function getExternalsFromReferences(tsConfigPath, ignorePatterns =
|
|
|
80
77
|
}));
|
|
81
78
|
}
|
|
82
79
|
const externals = await Promise.all(promises);
|
|
83
|
-
|
|
80
|
+
console.debug({ externals });
|
|
84
81
|
return externals;
|
|
85
82
|
}
|
|
86
83
|
export async function getDependencies(packageName, production) {
|
|
@@ -90,13 +87,11 @@ export async function getDependencies(packageName, production) {
|
|
|
90
87
|
if (packageName) {
|
|
91
88
|
const packageDir = await getPackageDir(packageName);
|
|
92
89
|
cmd = `cd ${packageDir.trim()} && ${cmd}`;
|
|
93
|
-
|
|
90
|
+
console.info(`Running command ${cmd} in ${packageDir}`);
|
|
94
91
|
}
|
|
95
92
|
const { stdout, stderr } = await exec(cmd);
|
|
96
93
|
if (stderr) {
|
|
97
|
-
throw new
|
|
98
|
-
context: { stderr },
|
|
99
|
-
});
|
|
94
|
+
throw new Error("CONFIG.INVALID_PACKAGE_DIR");
|
|
100
95
|
}
|
|
101
96
|
const deps = [];
|
|
102
97
|
const peerDeps = [];
|
|
@@ -104,13 +99,13 @@ export async function getDependencies(packageName, production) {
|
|
|
104
99
|
if (line.includes("UNMET OPTIONAL DEPENDENCY")) {
|
|
105
100
|
const parts = line.match(peerDepsRegex);
|
|
106
101
|
if (parts && parts.length > 1) {
|
|
107
|
-
peerDeps.push(
|
|
102
|
+
peerDeps.push(parts[1]);
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
else {
|
|
111
106
|
const parts = line.match(depsRegex);
|
|
112
107
|
if (parts && parts.length > 1) {
|
|
113
|
-
deps.push(
|
|
108
|
+
deps.push(parts[1]);
|
|
114
109
|
}
|
|
115
110
|
}
|
|
116
111
|
}
|
package/dist/dependencies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"AAcA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WA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,GAAG,CAAC,EAAE,CAAC,CAAC;IAEnD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAClC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACP,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const nodejsPolarsDirnamePlugin: (logger: Logger) => {
|
|
1
|
+
export declare const nodejsPolarsDirnamePlugin: () => {
|
|
3
2
|
name: string;
|
|
4
3
|
resolveId(source: string, importer: string | undefined, options: any): string | null;
|
|
5
4
|
transform(code: string, id: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodejsPolarsDirnamePlugin.d.ts","sourceRoot":"","sources":["../../src/vite/NodejsPolarsDirnamePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodejsPolarsDirnamePlugin.d.ts","sourceRoot":"","sources":["../../src/vite/NodejsPolarsDirnamePlugin.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,yBAAyB;;sBAKlB,MAAM,YAAY,MAAM,GAAG,SAAS,WAAW,GAAG;oBAUpD,MAAM,MAAM,MAAM;CAenC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export const nodejsPolarsDirnamePlugin = (
|
|
1
|
+
export const nodejsPolarsDirnamePlugin = () => {
|
|
2
2
|
const name = "nodejs-polars-dirname-plugin";
|
|
3
3
|
return {
|
|
4
4
|
name,
|
|
5
5
|
resolveId(source, importer, options) {
|
|
6
6
|
if (source.endsWith("nodejs-polars/bin/native-polars.js")) {
|
|
7
|
-
|
|
7
|
+
console.debug(name, "resolves", source, "imported by", importer);
|
|
8
8
|
return source;
|
|
9
9
|
}
|
|
10
10
|
return null;
|
|
11
11
|
},
|
|
12
12
|
transform(code, id) {
|
|
13
13
|
if (id.endsWith("nodejs-polars/bin/native-polars.js")) {
|
|
14
|
-
|
|
14
|
+
console.debug(name, "transform", id);
|
|
15
15
|
const newCode = code.replaceAll("__dirname", `new URL(import.meta.url).pathname.split('/').slice(0,-1).join('/')`);
|
|
16
16
|
return newCode;
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodejsPolarsDirnamePlugin.js","sourceRoot":"","sources":["../../src/vite/NodejsPolarsDirnamePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodejsPolarsDirnamePlugin.js","sourceRoot":"","sources":["../../src/vite/NodejsPolarsDirnamePlugin.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC7C,MAAM,IAAI,GAAG,8BAA8B,CAAC;IAC5C,OAAO;QACN,IAAI;QAEJ,SAAS,CAAC,MAAc,EAAE,QAA4B,EAAE,OAAY;YAEnE,IAAI,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAC,EAAE,CAAC;gBAC3D,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;gBAEjE,OAAO,MAAM,CAAC;YACf,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC;QACD,SAAS,CAAC,IAAY,EAAE,EAAU;YAEjC,IAAI,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC,EAAE,CAAC;gBAEvD,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;gBACrC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAC9B,WAAW,EACX,oEAAoE,CACpE,CAAC;gBACF,OAAO,OAAO,CAAC;YAChB,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const nodejsPolarsNativeFilePlugin: (logger: Logger, nodeFiles: string[], outDir: string) => {
|
|
1
|
+
export declare const nodejsPolarsNativeFilePlugin: (nodeFiles: string[], outDir: string) => {
|
|
3
2
|
name: string;
|
|
4
3
|
resolveId(source: string, importer: string | undefined, options: any): string | null;
|
|
5
4
|
transform(code: string, id: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodejsPolarsNativeFilePlugin.d.ts","sourceRoot":"","sources":["../../src/vite/NodejsPolarsNativeFilePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodejsPolarsNativeFilePlugin.d.ts","sourceRoot":"","sources":["../../src/vite/NodejsPolarsNativeFilePlugin.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,4BAA4B,cAC7B,MAAM,EAAE,UACX,MAAM;;sBAMK,MAAM,YAAY,MAAM,GAAG,SAAS,WAAW,GAAG;oBAUpD,MAAM,MAAM,MAAM;aAsBzB,MAAM;4BAYS,GAAG,UAAU,GAAG;CAazC,CAAC"}
|