@powerlines/plugin-vite 0.14.121 → 0.14.123
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/dist/helpers/index.cjs +3 -2
- package/dist/helpers/index.d.cts +3 -1
- package/dist/helpers/index.d.mts +3 -1
- package/dist/helpers/index.mjs +2 -1
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +2 -6
- package/dist/helpers/unplugin.d.mts +2 -6
- package/dist/helpers/unplugin.mjs +1 -9
- package/dist/helpers-CmEjzAn_.mjs +1 -0
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-BR1oNnaF.d.cts +1 -0
- package/dist/index-DEHBdV_z.d.mts +1 -0
- package/dist/index-_wQ5ClJU.d.cts +1 -0
- package/dist/index-vkGVyY9v.d.mts +1 -0
- package/dist/index.cjs +170 -9
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +165 -3
- package/dist/plugin-DltT0Eo-.d.mts +1953 -0
- package/dist/plugin-ig0w5dJe.d.cts +1950 -0
- package/dist/plugin-jZ9N9Mz-.mjs +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/internal.d.cts +191 -3
- package/dist/types/internal.d.mts +191 -3
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -12
- package/dist/types/plugin.d.mts +1 -12
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-BtDR9wb1.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-BhONWbBU.d.cts +7 -0
- package/dist/unplugin-Bs-gD2UV.cjs +4659 -0
- package/dist/unplugin-ChUI7J-4.d.mts +7 -0
- package/dist/unplugin-coawd-Mc.mjs +4615 -0
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/schemas/fs.cjs +0 -226
- package/dist/powerlines/schemas/fs.mjs +0 -224
- package/dist/powerlines/src/api.cjs +0 -580
- package/dist/powerlines/src/api.mjs +0 -578
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
- package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
- package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
- package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -48
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -50
- package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
- package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
- package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
- package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
- package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
- package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
- package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
- package/dist/powerlines/src/lib/build/vite.cjs +0 -74
- package/dist/powerlines/src/lib/build/vite.mjs +0 -71
- package/dist/powerlines/src/lib/config-file.cjs +0 -79
- package/dist/powerlines/src/lib/config-file.mjs +0 -76
- package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
- package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
- package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
- package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
- package/dist/powerlines/src/lib/entry.cjs +0 -69
- package/dist/powerlines/src/lib/entry.mjs +0 -67
- package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
- package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
- package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
- package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
- package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
- package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
- package/dist/powerlines/src/lib/logger.cjs +0 -58
- package/dist/powerlines/src/lib/logger.mjs +0 -55
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
- package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
- package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
- package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
- package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
- package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
- package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/api.d.cts +0 -104
- package/dist/powerlines/src/types/api.d.mts +0 -104
- package/dist/powerlines/src/types/babel.d.mts +0 -4
- package/dist/powerlines/src/types/build.cjs +0 -15
- package/dist/powerlines/src/types/build.d.cts +0 -154
- package/dist/powerlines/src/types/build.d.mts +0 -154
- package/dist/powerlines/src/types/build.mjs +0 -14
- package/dist/powerlines/src/types/commands.cjs +0 -16
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/commands.mjs +0 -15
- package/dist/powerlines/src/types/config.d.cts +0 -416
- package/dist/powerlines/src/types/config.d.mts +0 -418
- package/dist/powerlines/src/types/context.d.cts +0 -514
- package/dist/powerlines/src/types/context.d.mts +0 -514
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.cts +0 -30
- package/dist/powerlines/src/types/hooks.d.mts +0 -30
- package/dist/powerlines/src/types/internal.d.cts +0 -58
- package/dist/powerlines/src/types/internal.d.mts +0 -58
- package/dist/powerlines/src/types/plugin.cjs +0 -32
- package/dist/powerlines/src/types/plugin.d.cts +0 -234
- package/dist/powerlines/src/types/plugin.d.mts +0 -234
- package/dist/powerlines/src/types/plugin.mjs +0 -31
- package/dist/powerlines/src/types/resolved.d.cts +0 -82
- package/dist/powerlines/src/types/resolved.d.mts +0 -83
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_unplugin = require('../unplugin-Bs-gD2UV.cjs');
|
|
2
|
+
require('../helpers-LF26RHol.cjs');
|
|
2
3
|
|
|
3
|
-
exports.createVitePlugin =
|
|
4
|
+
exports.createVitePlugin = require_unplugin.createVitePlugin;
|
package/dist/helpers/index.d.cts
CHANGED
package/dist/helpers/index.d.mts
CHANGED
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_plugin = require('../powerlines/src/lib/unplugin/plugin.cjs');
|
|
3
|
-
require('../powerlines/src/lib/unplugin/index.cjs');
|
|
4
|
-
let unplugin = require("unplugin");
|
|
1
|
+
const require_unplugin = require('../unplugin-Bs-gD2UV.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
function createVitePlugin(context) {
|
|
8
|
-
return (0, unplugin.createVitePlugin)(require_plugin.createUnplugin(context))({});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
exports.createVitePlugin = createVitePlugin;
|
|
3
|
+
exports.createVitePlugin = require_unplugin.createVitePlugin;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createVitePlugin(context: VitePluginContext): vite0.Plugin<any> | vite0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-ig0w5dJe.cjs";
|
|
2
|
+
import { t as createVitePlugin } from "../unplugin-BhONWbBU.cjs";
|
|
7
3
|
export { createVitePlugin };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/unplugin.d.ts
|
|
5
|
-
declare function createVitePlugin(context: VitePluginContext): vite0.Plugin<any> | vite0.Plugin<any>[];
|
|
6
|
-
//#endregion
|
|
1
|
+
import "../plugin-DltT0Eo-.mjs";
|
|
2
|
+
import { t as createVitePlugin } from "../unplugin-ChUI7J-4.mjs";
|
|
7
3
|
export { createVitePlugin };
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../powerlines/src/lib/unplugin/index.mjs";
|
|
3
|
-
import { createVitePlugin as createVitePlugin$1 } from "unplugin";
|
|
1
|
+
import { t as createVitePlugin } from "../unplugin-coawd-Mc.mjs";
|
|
4
2
|
|
|
5
|
-
//#region src/helpers/unplugin.ts
|
|
6
|
-
function createVitePlugin(context) {
|
|
7
|
-
return createVitePlugin$1(createUnplugin(context))({});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
3
|
export { createVitePlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,174 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require('./
|
|
2
|
+
const require_unplugin = require('./unplugin-Bs-gD2UV.cjs');
|
|
3
|
+
require('./helpers-LF26RHol.cjs');
|
|
4
|
+
require('./plugin-pBKbb5K9.cjs');
|
|
5
|
+
require('./types-o3zWarRp.cjs');
|
|
6
6
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
7
|
let defu = require("defu");
|
|
8
|
-
defu =
|
|
8
|
+
defu = require_unplugin.__toESM(defu);
|
|
9
|
+
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
10
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
11
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
12
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
13
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
14
|
let vite = require("vite");
|
|
10
15
|
|
|
16
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
17
|
+
const DEFAULT_ESBUILD_CONFIG = {
|
|
18
|
+
target: "esnext",
|
|
19
|
+
platform: "neutral",
|
|
20
|
+
format: "esm",
|
|
21
|
+
write: true,
|
|
22
|
+
minify: true,
|
|
23
|
+
sourcemap: false,
|
|
24
|
+
bundle: true,
|
|
25
|
+
treeShaking: true,
|
|
26
|
+
keepNames: true,
|
|
27
|
+
splitting: true,
|
|
28
|
+
logLevel: "silent"
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the esbuild options.
|
|
32
|
+
*
|
|
33
|
+
* @param context - The build context.
|
|
34
|
+
* @returns The resolved esbuild options.
|
|
35
|
+
*/
|
|
36
|
+
function extractESBuildConfig(context) {
|
|
37
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
38
|
+
if (inject && Object.keys(inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
39
|
+
if (value) if (Array.isArray(value)) {
|
|
40
|
+
if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
|
|
41
|
+
if (value.length === 1) return `
|
|
42
|
+
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
43
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
44
|
+
else if (value.length > 1) return `
|
|
45
|
+
import ${value[1] === "*" ? `* as ${(0, __stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, __stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
|
|
46
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
47
|
+
} else if (value.length === 1) return `
|
|
48
|
+
import ${key} from "${value[0]}";
|
|
49
|
+
export { ${key} };`;
|
|
50
|
+
else if (value.length > 1) return `
|
|
51
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
52
|
+
export { ${key} };`;
|
|
53
|
+
} else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
|
|
54
|
+
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
55
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
56
|
+
else return `
|
|
57
|
+
import ${key} from "${value}";
|
|
58
|
+
export { ${key} };`;
|
|
59
|
+
return "";
|
|
60
|
+
}).join("\n"));
|
|
61
|
+
return (0, defu.default)({
|
|
62
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
63
|
+
if (!ret[id]) {
|
|
64
|
+
const path = context.fs.ids[id];
|
|
65
|
+
if (path) ret[id] = path;
|
|
66
|
+
}
|
|
67
|
+
return ret;
|
|
68
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
69
|
+
if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
|
|
70
|
+
return ret;
|
|
71
|
+
}, {}) : context.config.build.alias : {}),
|
|
72
|
+
inject: inject && Object.keys(inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
|
|
73
|
+
}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
|
|
74
|
+
"alias",
|
|
75
|
+
"inject",
|
|
76
|
+
"external",
|
|
77
|
+
"noExternal",
|
|
78
|
+
"skipNodeModulesBundle",
|
|
79
|
+
"extensions"
|
|
80
|
+
]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
|
|
81
|
+
"alias",
|
|
82
|
+
"inject",
|
|
83
|
+
"external",
|
|
84
|
+
"noExternal",
|
|
85
|
+
"skipNodeModulesBundle",
|
|
86
|
+
"extensions",
|
|
87
|
+
"variant",
|
|
88
|
+
"override"
|
|
89
|
+
]) : {}, {
|
|
90
|
+
mainFields: context.config.build.mainFields,
|
|
91
|
+
conditions: context.config.build.conditions,
|
|
92
|
+
define: context.config.build.define,
|
|
93
|
+
resolveExtensions: context.config.build.extensions,
|
|
94
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
95
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
96
|
+
platform: context.config.build.platform,
|
|
97
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
98
|
+
outdir: context.config.output.buildPath,
|
|
99
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
100
|
+
minify: context.config.mode !== "development",
|
|
101
|
+
metafile: context.config.mode === "development",
|
|
102
|
+
sourcemap: context.config.mode === "development"
|
|
103
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../powerlines/src/lib/build/vite.ts
|
|
108
|
+
const DEFAULT_VITE_CONFIG = {
|
|
109
|
+
resolve: { extensions: [
|
|
110
|
+
".mjs",
|
|
111
|
+
".js",
|
|
112
|
+
".mts",
|
|
113
|
+
".ts",
|
|
114
|
+
".jsx",
|
|
115
|
+
".tsx",
|
|
116
|
+
".json"
|
|
117
|
+
] },
|
|
118
|
+
json: { stringify: true },
|
|
119
|
+
logLevel: "silent",
|
|
120
|
+
clearScreen: true
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Resolves the options for [vite](https://vitejs.dev/).
|
|
124
|
+
*
|
|
125
|
+
* @param context - The build context.
|
|
126
|
+
* @returns The resolved options.
|
|
127
|
+
*/
|
|
128
|
+
function extractViteConfig(context) {
|
|
129
|
+
return (0, defu.default)({ resolve: {
|
|
130
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
131
|
+
if (!ret.find((e) => e.find === id)) {
|
|
132
|
+
const path = context.fs.ids[id];
|
|
133
|
+
if (path) ret.push({
|
|
134
|
+
find: id,
|
|
135
|
+
replacement: path
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return ret;
|
|
139
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
140
|
+
if (!ret.find((e) => e.find === id)) ret.push({
|
|
141
|
+
find: id,
|
|
142
|
+
replacement: path
|
|
143
|
+
});
|
|
144
|
+
return ret;
|
|
145
|
+
}, []) : []),
|
|
146
|
+
dedupe: context.config.build.dedupe,
|
|
147
|
+
mainFields: context.config.build.mainFields,
|
|
148
|
+
conditions: context.config.build.conditions,
|
|
149
|
+
extensions: context.config.build.extensions
|
|
150
|
+
} }, context.config.build.variant === "vite" ? (0, defu.default)(context.config.build.override ?? {}, { optimizeDeps: context.config.build.override?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.override?.extensions } }) : {}, context.config.build.variant === "vite" ? (0, defu.default)((0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]), { optimizeDeps: context.config.build?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.extensions } }) : {}, {
|
|
151
|
+
keepProcessEnv: context.config.build.keepProcessEnv,
|
|
152
|
+
define: context.config.build.define,
|
|
153
|
+
rootDir: context.config.sourceRoot,
|
|
154
|
+
platform: context.config.build.platform,
|
|
155
|
+
mode: context.config.mode === "development" ? "development" : "production",
|
|
156
|
+
cacheDir: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "vite"),
|
|
157
|
+
build: {
|
|
158
|
+
minify: context.config.mode !== "development",
|
|
159
|
+
metafile: context.config.mode === "development",
|
|
160
|
+
sourcemap: context.config.mode === "development",
|
|
161
|
+
outDir: context.config.output.buildPath,
|
|
162
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
163
|
+
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
164
|
+
},
|
|
165
|
+
esbuild: extractESBuildConfig(context),
|
|
166
|
+
logLevel: context.config.logLevel ?? void 0,
|
|
167
|
+
envDir: context.config.projectRoot
|
|
168
|
+
}, DEFAULT_VITE_CONFIG);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
11
172
|
//#region src/index.ts
|
|
12
173
|
/**
|
|
13
174
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
@@ -20,7 +181,7 @@ const plugin = (options = {}) => {
|
|
|
20
181
|
return {
|
|
21
182
|
output: { format: ["cjs", "esm"] },
|
|
22
183
|
build: {
|
|
23
|
-
...
|
|
184
|
+
...DEFAULT_VITE_CONFIG,
|
|
24
185
|
...options,
|
|
25
186
|
variant: "vite"
|
|
26
187
|
},
|
|
@@ -35,14 +196,14 @@ const plugin = (options = {}) => {
|
|
|
35
196
|
await (0, vite.build)((0, defu.default)({
|
|
36
197
|
config: false,
|
|
37
198
|
entry: this.entry,
|
|
38
|
-
environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name,
|
|
39
|
-
},
|
|
199
|
+
environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name, extractViteConfig(env)]))
|
|
200
|
+
}, extractViteConfig(this), { plugins: [require_unplugin.createVitePlugin(this)] }));
|
|
40
201
|
}
|
|
41
202
|
};
|
|
42
203
|
};
|
|
43
204
|
var src_default = plugin;
|
|
44
205
|
|
|
45
206
|
//#endregion
|
|
46
|
-
exports.createVitePlugin =
|
|
207
|
+
exports.createVitePlugin = require_unplugin.createVitePlugin;
|
|
47
208
|
exports.default = src_default;
|
|
48
209
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { S as Plugin, a as __ΩVitePluginOptions, i as __ΩVitePluginContext, n as VitePluginOptions, o as __ΩVitePluginResolvedConfig, r as VitePluginResolvedConfig, t as VitePluginContext } from "./plugin-ig0w5dJe.cjs";
|
|
2
|
+
import { t as createVitePlugin } from "./unplugin-BhONWbBU.cjs";
|
|
3
|
+
import "./index-_wQ5ClJU.cjs";
|
|
4
|
+
import "./index-BR1oNnaF.cjs";
|
|
4
5
|
|
|
5
6
|
//#region src/index.d.ts
|
|
6
7
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import "./types/index.mjs";
|
|
1
|
+
import { S as Plugin, a as __ΩVitePluginOptions, i as __ΩVitePluginContext, n as VitePluginOptions, o as __ΩVitePluginResolvedConfig, r as VitePluginResolvedConfig, t as VitePluginContext } from "./plugin-DltT0Eo-.mjs";
|
|
2
|
+
import { t as createVitePlugin } from "./unplugin-ChUI7J-4.mjs";
|
|
3
|
+
import "./index-vkGVyY9v.mjs";
|
|
4
|
+
import "./index-DEHBdV_z.mjs";
|
|
6
5
|
|
|
7
6
|
//#region src/index.d.ts
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,172 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
1
|
+
import { t as createVitePlugin } from "./unplugin-coawd-Mc.mjs";
|
|
2
|
+
import "./helpers-CmEjzAn_.mjs";
|
|
3
|
+
import "./plugin-jZ9N9Mz-.mjs";
|
|
4
|
+
import "./types-BtDR9wb1.mjs";
|
|
4
5
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
6
|
import defu$1 from "defu";
|
|
7
|
+
import { omit } from "@stryke/helpers/omit";
|
|
8
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
10
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
11
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
12
|
import { build } from "vite";
|
|
7
13
|
|
|
14
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
15
|
+
const DEFAULT_ESBUILD_CONFIG = {
|
|
16
|
+
target: "esnext",
|
|
17
|
+
platform: "neutral",
|
|
18
|
+
format: "esm",
|
|
19
|
+
write: true,
|
|
20
|
+
minify: true,
|
|
21
|
+
sourcemap: false,
|
|
22
|
+
bundle: true,
|
|
23
|
+
treeShaking: true,
|
|
24
|
+
keepNames: true,
|
|
25
|
+
splitting: true,
|
|
26
|
+
logLevel: "silent"
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the esbuild options.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The build context.
|
|
32
|
+
* @returns The resolved esbuild options.
|
|
33
|
+
*/
|
|
34
|
+
function extractESBuildConfig(context) {
|
|
35
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
36
|
+
if (inject && Object.keys(inject).length > 0) context.fs.writeSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
37
|
+
if (value) if (Array.isArray(value)) {
|
|
38
|
+
if (camelCase(key) !== key) {
|
|
39
|
+
if (value.length === 1) return `
|
|
40
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
41
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
42
|
+
else if (value.length > 1) return `
|
|
43
|
+
import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
|
|
44
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
45
|
+
} else if (value.length === 1) return `
|
|
46
|
+
import ${key} from "${value[0]}";
|
|
47
|
+
export { ${key} };`;
|
|
48
|
+
else if (value.length > 1) return `
|
|
49
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
50
|
+
export { ${key} };`;
|
|
51
|
+
} else if (camelCase(key) !== key) return `
|
|
52
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
53
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
54
|
+
else return `
|
|
55
|
+
import ${key} from "${value}";
|
|
56
|
+
export { ${key} };`;
|
|
57
|
+
return "";
|
|
58
|
+
}).join("\n"));
|
|
59
|
+
return defu$1({
|
|
60
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
61
|
+
if (!ret[id]) {
|
|
62
|
+
const path = context.fs.ids[id];
|
|
63
|
+
if (path) ret[id] = path;
|
|
64
|
+
}
|
|
65
|
+
return ret;
|
|
66
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
67
|
+
if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
|
|
68
|
+
return ret;
|
|
69
|
+
}, {}) : context.config.build.alias : {}),
|
|
70
|
+
inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
|
|
71
|
+
}, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
|
|
72
|
+
"alias",
|
|
73
|
+
"inject",
|
|
74
|
+
"external",
|
|
75
|
+
"noExternal",
|
|
76
|
+
"skipNodeModulesBundle",
|
|
77
|
+
"extensions"
|
|
78
|
+
]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
|
|
79
|
+
"alias",
|
|
80
|
+
"inject",
|
|
81
|
+
"external",
|
|
82
|
+
"noExternal",
|
|
83
|
+
"skipNodeModulesBundle",
|
|
84
|
+
"extensions",
|
|
85
|
+
"variant",
|
|
86
|
+
"override"
|
|
87
|
+
]) : {}, {
|
|
88
|
+
mainFields: context.config.build.mainFields,
|
|
89
|
+
conditions: context.config.build.conditions,
|
|
90
|
+
define: context.config.build.define,
|
|
91
|
+
resolveExtensions: context.config.build.extensions,
|
|
92
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
93
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
94
|
+
platform: context.config.build.platform,
|
|
95
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
96
|
+
outdir: context.config.output.buildPath,
|
|
97
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
98
|
+
minify: context.config.mode !== "development",
|
|
99
|
+
metafile: context.config.mode === "development",
|
|
100
|
+
sourcemap: context.config.mode === "development"
|
|
101
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region ../powerlines/src/lib/build/vite.ts
|
|
106
|
+
const DEFAULT_VITE_CONFIG = {
|
|
107
|
+
resolve: { extensions: [
|
|
108
|
+
".mjs",
|
|
109
|
+
".js",
|
|
110
|
+
".mts",
|
|
111
|
+
".ts",
|
|
112
|
+
".jsx",
|
|
113
|
+
".tsx",
|
|
114
|
+
".json"
|
|
115
|
+
] },
|
|
116
|
+
json: { stringify: true },
|
|
117
|
+
logLevel: "silent",
|
|
118
|
+
clearScreen: true
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Resolves the options for [vite](https://vitejs.dev/).
|
|
122
|
+
*
|
|
123
|
+
* @param context - The build context.
|
|
124
|
+
* @returns The resolved options.
|
|
125
|
+
*/
|
|
126
|
+
function extractViteConfig(context) {
|
|
127
|
+
return defu$1({ resolve: {
|
|
128
|
+
alias: context.builtins.reduce((ret, id) => {
|
|
129
|
+
if (!ret.find((e) => e.find === id)) {
|
|
130
|
+
const path = context.fs.ids[id];
|
|
131
|
+
if (path) ret.push({
|
|
132
|
+
find: id,
|
|
133
|
+
replacement: path
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return ret;
|
|
137
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
138
|
+
if (!ret.find((e) => e.find === id)) ret.push({
|
|
139
|
+
find: id,
|
|
140
|
+
replacement: path
|
|
141
|
+
});
|
|
142
|
+
return ret;
|
|
143
|
+
}, []) : []),
|
|
144
|
+
dedupe: context.config.build.dedupe,
|
|
145
|
+
mainFields: context.config.build.mainFields,
|
|
146
|
+
conditions: context.config.build.conditions,
|
|
147
|
+
extensions: context.config.build.extensions
|
|
148
|
+
} }, context.config.build.variant === "vite" ? defu$1(context.config.build.override ?? {}, { optimizeDeps: context.config.build.override?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.override?.extensions } }) : {}, context.config.build.variant === "vite" ? defu$1(omit(context.config.build, ["override", "variant"]), { optimizeDeps: context.config.build?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.extensions } }) : {}, {
|
|
149
|
+
keepProcessEnv: context.config.build.keepProcessEnv,
|
|
150
|
+
define: context.config.build.define,
|
|
151
|
+
rootDir: context.config.sourceRoot,
|
|
152
|
+
platform: context.config.build.platform,
|
|
153
|
+
mode: context.config.mode === "development" ? "development" : "production",
|
|
154
|
+
cacheDir: joinPaths(context.cachePath, "vite"),
|
|
155
|
+
build: {
|
|
156
|
+
minify: context.config.mode !== "development",
|
|
157
|
+
metafile: context.config.mode === "development",
|
|
158
|
+
sourcemap: context.config.mode === "development",
|
|
159
|
+
outDir: context.config.output.buildPath,
|
|
160
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
161
|
+
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
162
|
+
},
|
|
163
|
+
esbuild: extractESBuildConfig(context),
|
|
164
|
+
logLevel: context.config.logLevel ?? void 0,
|
|
165
|
+
envDir: context.config.projectRoot
|
|
166
|
+
}, DEFAULT_VITE_CONFIG);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
8
170
|
//#region src/index.ts
|
|
9
171
|
/**
|
|
10
172
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|