@keychord/config 0.0.5 → 0.0.6
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/exports/default.d.mts +5 -1
- package/exports/default.mjs +28 -25
- package/package.json +1 -1
- package/src/default.ts +5 -1
package/exports/default.d.mts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
type Options = {
|
|
3
3
|
vendor?: string[];
|
|
4
4
|
dts?: boolean;
|
|
5
|
+
plugins?: any[];
|
|
5
6
|
};
|
|
6
7
|
declare function config(options?: Options): {
|
|
8
|
+
plugins: any[] | undefined;
|
|
7
9
|
pack: ({
|
|
8
10
|
entry: string;
|
|
9
11
|
clean: boolean;
|
|
@@ -16,7 +18,9 @@ declare function config(options?: Options): {
|
|
|
16
18
|
neverBundle: string[];
|
|
17
19
|
};
|
|
18
20
|
} | {
|
|
19
|
-
entry:
|
|
21
|
+
entry: {
|
|
22
|
+
'package.json': string;
|
|
23
|
+
};
|
|
20
24
|
copy: {
|
|
21
25
|
from: string;
|
|
22
26
|
to: string;
|
package/exports/default.mjs
CHANGED
|
@@ -5,31 +5,34 @@ function config(options) {
|
|
|
5
5
|
const srcJsDirpath = path.join(process.cwd(), "src/js");
|
|
6
6
|
let entry = {};
|
|
7
7
|
if (fs.existsSync(srcJsDirpath) && fs.statSync(srcJsDirpath).isDirectory()) for (const filename of fs.readdirSync(srcJsDirpath).filter((file) => file.endsWith(".ts"))) entry[path.parse(filename).name] = path.join(srcJsDirpath, filename);
|
|
8
|
-
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
8
|
+
return {
|
|
9
|
+
plugins: options?.plugins,
|
|
10
|
+
pack: [{
|
|
11
|
+
entry: { "package.json": "package.json" },
|
|
12
|
+
copy: options?.vendor?.flatMap((packageName) => {
|
|
13
|
+
return [{
|
|
14
|
+
from: `node_modules/${packageName}/js`,
|
|
15
|
+
to: `js/${packageName}`
|
|
16
|
+
}, {
|
|
17
|
+
from: `node_modules/${packageName}/chords`,
|
|
18
|
+
to: `chords/${packageName}`
|
|
19
|
+
}];
|
|
20
|
+
}),
|
|
21
|
+
outDir: "js",
|
|
22
|
+
fixedExtension: false
|
|
23
|
+
}, ...Object.values(entry).map((entry) => ({
|
|
24
|
+
entry,
|
|
25
|
+
clean: false,
|
|
26
|
+
outDir: "js",
|
|
27
|
+
dts: options?.dts,
|
|
28
|
+
fixedExtension: false,
|
|
29
|
+
deps: {
|
|
30
|
+
onlyBundle: false,
|
|
31
|
+
alwaysBundle: [/.*/],
|
|
32
|
+
neverBundle: ["chord", ...options?.vendor ?? []]
|
|
33
|
+
}
|
|
34
|
+
}))]
|
|
35
|
+
};
|
|
33
36
|
}
|
|
34
37
|
//#endregion
|
|
35
38
|
export { config };
|
package/package.json
CHANGED
package/src/default.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { UserConfig } from "vite-plus";
|
|
|
5
5
|
export type Options = {
|
|
6
6
|
vendor?: string[];
|
|
7
7
|
dts?: boolean;
|
|
8
|
+
plugins?: any[]
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
// Needs to be named `config` or else vite-plus thinks it's its `defineConfig`
|
|
@@ -22,9 +23,12 @@ export function config(options?: Options) {
|
|
|
22
23
|
// const eslintBinPath = path.join(fileURLToPath(import.meta.resolve('eslint/package.json')), '../bin/eslint.js');
|
|
23
24
|
|
|
24
25
|
return {
|
|
26
|
+
plugins: options?.plugins,
|
|
25
27
|
pack: [
|
|
26
28
|
{
|
|
27
|
-
entry:
|
|
29
|
+
entry: {
|
|
30
|
+
'package.json': 'package.json',
|
|
31
|
+
},
|
|
28
32
|
copy: options?.vendor?.flatMap(packageName => {
|
|
29
33
|
return [
|
|
30
34
|
{ from: `node_modules/${packageName}/js`, to: `js/${packageName}` },
|