@powerlines/nx 0.10.23 → 0.10.26
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 +28 -0
- package/dist/{chunk-IPVB7OAF.js → chunk-2SFOQMAA.js} +34 -494
- package/dist/{chunk-7JI7SNPI.js → chunk-4A6Y7MGQ.js} +2 -2
- package/dist/{chunk-C7YXZ6X3.mjs → chunk-6UH4EGMN.mjs} +1 -1
- package/dist/{chunk-62CNXBCW.js → chunk-6WVDB4DZ.js} +2 -2
- package/dist/{chunk-SBOWIOOS.js → chunk-7TPTVC3S.js} +2 -2
- package/dist/{chunk-Z6JAOALZ.js → chunk-A26KXB6A.js} +2 -2
- package/dist/{chunk-NQA6VVBG.mjs → chunk-A7SAZMVH.mjs} +1 -1
- package/dist/{chunk-LTCZN4I4.js → chunk-ACE6O62X.js} +11 -19
- package/dist/{chunk-SJ6WM4OK.js → chunk-B5L3T46G.js} +2 -2
- package/dist/{chunk-XRMEXEW2.mjs → chunk-BXKPRYNH.mjs} +8 -8
- package/dist/{chunk-OY7HISJN.mjs → chunk-IAWSQ5AX.mjs} +27 -487
- package/dist/{chunk-7N6FX55G.js → chunk-JPTGZQLU.js} +9 -9
- package/dist/{chunk-JFEKW6WO.mjs → chunk-KCL7KVDF.mjs} +1 -1
- package/dist/{chunk-R6VKTKIJ.mjs → chunk-L46S3DXB.mjs} +1 -1
- package/dist/{chunk-XL4OPEOX.mjs → chunk-ONWCIW2E.mjs} +1 -1
- package/dist/{chunk-JZFLLKX7.js → chunk-PJYRCGK4.js} +2 -2
- package/dist/{chunk-FMYWKI25.mjs → chunk-X6GFPXO4.mjs} +12 -19
- package/dist/{chunk-IZ2DVA7V.mjs → chunk-Z22G7IM3.mjs} +1 -1
- package/dist/executors.js +12 -12
- package/dist/executors.mjs +7 -7
- package/dist/index.js +15 -15
- package/dist/index.mjs +9 -9
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +2 -2
- package/dist/src/executors/build/executor.js +5 -5
- package/dist/src/executors/build/executor.mjs +3 -3
- package/dist/src/executors/clean/executor.js +5 -5
- package/dist/src/executors/clean/executor.mjs +3 -3
- package/dist/src/executors/docs/executor.js +5 -5
- package/dist/src/executors/docs/executor.mjs +3 -3
- package/dist/src/executors/lint/executor.js +5 -5
- package/dist/src/executors/lint/executor.mjs +3 -3
- package/dist/src/executors/prepare/executor.js +5 -5
- package/dist/src/executors/prepare/executor.mjs +3 -3
- package/dist/src/helpers/plugin-utilities.js +5 -5
- package/dist/src/helpers/plugin-utilities.mjs +2 -2
- package/dist/src/plugin/index.js +4 -4
- package/dist/src/plugin/index.mjs +3 -3
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadWorkspaceConfig, CACHE_HASH_LENGTH, PROJECT_ROOT_HASH_LENGTH, getPrefixedProjectRootHash,
|
|
1
|
+
import { loadWorkspaceConfig, CACHE_HASH_LENGTH, PROJECT_ROOT_HASH_LENGTH, getPrefixedProjectRootHash, loadUserConfigFile, writeMetaFile } from './chunk-X6GFPXO4.mjs';
|
|
2
2
|
import { __name } from './chunk-O6YSETKJ.mjs';
|
|
3
3
|
import { getLogFn, getLogLevel, writeError } from '@storm-software/config-tools/logger';
|
|
4
4
|
import { withRunExecutor } from '@storm-software/workspace-tools/base/base-executor';
|
|
@@ -39,7 +39,8 @@ import { titleCase } from '@stryke/string-format/title-case';
|
|
|
39
39
|
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
40
40
|
import { resolveConfig, format } from 'prettier';
|
|
41
41
|
import { getEnvPaths } from '@stryke/env/get-env-paths';
|
|
42
|
-
import { relativeToWorkspaceRoot
|
|
42
|
+
import { relativeToWorkspaceRoot } from '@stryke/fs/get-workspace-root';
|
|
43
|
+
import { hashDirectory } from '@stryke/hash/hash-files';
|
|
43
44
|
import { murmurhash } from '@stryke/hash/murmurhash';
|
|
44
45
|
import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
45
46
|
import { omit } from '@stryke/helpers/omit';
|
|
@@ -65,14 +66,6 @@ import { isParentPath } from '@stryke/path/is-parent-path';
|
|
|
65
66
|
import { Volume } from 'memfs';
|
|
66
67
|
import { Union } from 'unionfs';
|
|
67
68
|
import { isObject } from '@stryke/type-checks/is-object';
|
|
68
|
-
import { isDevelopmentMode, isTestMode } from '@stryke/env/environment-checks';
|
|
69
|
-
import { createVitePlugin, createEsbuildPlugin, createWebpackPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnloaderPlugin } from 'unplugin';
|
|
70
|
-
import { camelCase } from '@stryke/string-format/camel-case';
|
|
71
|
-
import { match, tsconfigPathsToRegExp } from 'bundle-require';
|
|
72
|
-
import '@stryke/fs/read-file';
|
|
73
|
-
import 'magic-string';
|
|
74
|
-
import { defineNuxtModule, addVitePlugin, addWebpackPlugin } from '@nuxt/kit';
|
|
75
|
-
import '@nuxt/schema';
|
|
76
69
|
|
|
77
70
|
function resolveModulePath(nodePath, state) {
|
|
78
71
|
if (!t.isStringLiteral(nodePath.node)) {
|
|
@@ -700,8 +693,8 @@ function isHookExternal(hook) {
|
|
|
700
693
|
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
701
694
|
}
|
|
702
695
|
__name(isHookExternal, "isHookExternal");
|
|
703
|
-
function checkDedupe(plugin,
|
|
704
|
-
return plugin.dedupe === false ||
|
|
696
|
+
function checkDedupe(plugin, plugins) {
|
|
697
|
+
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
705
698
|
}
|
|
706
699
|
__name(checkDedupe, "checkDedupe");
|
|
707
700
|
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
@@ -3011,6 +3004,26 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3011
3004
|
*/
|
|
3012
3005
|
logFn;
|
|
3013
3006
|
/**
|
|
3007
|
+
* Generates a checksum representing the current context state
|
|
3008
|
+
*
|
|
3009
|
+
* @param root - The root directory of the project to generate the checksum for
|
|
3010
|
+
* @returns A promise that resolves to a string representing the checksum
|
|
3011
|
+
*/
|
|
3012
|
+
async generateChecksum(root = this.config.projectRoot) {
|
|
3013
|
+
this.#checksum = await hashDirectory(root, {
|
|
3014
|
+
ignore: [
|
|
3015
|
+
"node_modules",
|
|
3016
|
+
".git",
|
|
3017
|
+
".nx",
|
|
3018
|
+
".cache",
|
|
3019
|
+
".storm",
|
|
3020
|
+
"tmp",
|
|
3021
|
+
"dist"
|
|
3022
|
+
]
|
|
3023
|
+
});
|
|
3024
|
+
return this.#checksum;
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3014
3027
|
* Initialize the context with the provided configuration options
|
|
3015
3028
|
*
|
|
3016
3029
|
* @param config - The partial user configuration to use for initialization.
|
|
@@ -3042,7 +3055,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3042
3055
|
if (existsSync(packageJsonPath)) {
|
|
3043
3056
|
this.packageJson = await readJsonFile(packageJsonPath);
|
|
3044
3057
|
}
|
|
3045
|
-
this.#checksum = await
|
|
3058
|
+
this.#checksum = await this.generateChecksum(cacheKey.projectRoot);
|
|
3046
3059
|
this.resolver = createResolver({
|
|
3047
3060
|
workspaceRoot: this.workspaceConfig.workspaceRoot,
|
|
3048
3061
|
projectRoot: cacheKey.projectRoot,
|
|
@@ -3050,7 +3063,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3050
3063
|
mode: cacheKey.mode,
|
|
3051
3064
|
skipCache: cacheKey.skipCache
|
|
3052
3065
|
});
|
|
3053
|
-
const userConfig = await loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
3066
|
+
const userConfig = await loadUserConfigFile(cacheKey.projectRoot, this.workspaceConfig.workspaceRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
3054
3067
|
this.mergeUserConfig(userConfig.config);
|
|
3055
3068
|
configCache.set(cacheKey, {
|
|
3056
3069
|
projectJson: this.projectJson,
|
|
@@ -4166,479 +4179,6 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
4166
4179
|
}
|
|
4167
4180
|
}
|
|
4168
4181
|
};
|
|
4169
|
-
var DEFAULT_ESBUILD_CONFIG = {
|
|
4170
|
-
target: "esnext",
|
|
4171
|
-
platform: "neutral",
|
|
4172
|
-
format: "esm",
|
|
4173
|
-
write: true,
|
|
4174
|
-
minify: true,
|
|
4175
|
-
sourcemap: false,
|
|
4176
|
-
bundle: true,
|
|
4177
|
-
treeShaking: true,
|
|
4178
|
-
keepNames: true,
|
|
4179
|
-
splitting: true,
|
|
4180
|
-
logLevel: "silent"
|
|
4181
|
-
};
|
|
4182
|
-
function extractESBuildConfig(context) {
|
|
4183
|
-
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
4184
|
-
if (inject && Object.keys(inject).length > 0) {
|
|
4185
|
-
context.fs.writeFileSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
4186
|
-
if (value) {
|
|
4187
|
-
if (Array.isArray(value)) {
|
|
4188
|
-
if (camelCase(key) !== key) {
|
|
4189
|
-
if (value.length === 1) {
|
|
4190
|
-
return `
|
|
4191
|
-
import ${camelCase(key)} from "${value[0]}";
|
|
4192
|
-
export { ${camelCase(key)} as "${key}" }`;
|
|
4193
|
-
} else if (value.length > 1) {
|
|
4194
|
-
return `
|
|
4195
|
-
import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
|
|
4196
|
-
export { ${camelCase(key)} as "${key}" }`;
|
|
4197
|
-
}
|
|
4198
|
-
} else if (value.length === 1) {
|
|
4199
|
-
return `
|
|
4200
|
-
import ${key} from "${value[0]}";
|
|
4201
|
-
export { ${key} };`;
|
|
4202
|
-
} else if (value.length > 1) {
|
|
4203
|
-
return `
|
|
4204
|
-
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
4205
|
-
export { ${key} };`;
|
|
4206
|
-
}
|
|
4207
|
-
} else if (camelCase(key) !== key) {
|
|
4208
|
-
return `
|
|
4209
|
-
import ${camelCase(key)} from "${value[0]}";
|
|
4210
|
-
export { ${camelCase(key)} as "${key}" }`;
|
|
4211
|
-
} else {
|
|
4212
|
-
return `
|
|
4213
|
-
import ${key} from "${value}";
|
|
4214
|
-
export { ${key} };`;
|
|
4215
|
-
}
|
|
4216
|
-
}
|
|
4217
|
-
return "";
|
|
4218
|
-
}).join("\n"));
|
|
4219
|
-
}
|
|
4220
|
-
return defu5({
|
|
4221
|
-
alias: context.builtins.reduce((ret, id) => {
|
|
4222
|
-
if (!ret[id]) {
|
|
4223
|
-
const path = context.fs.ids[id];
|
|
4224
|
-
if (path) {
|
|
4225
|
-
ret[id] = path;
|
|
4226
|
-
}
|
|
4227
|
-
}
|
|
4228
|
-
return ret;
|
|
4229
|
-
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
4230
|
-
if (!ret[alias.find.toString()]) {
|
|
4231
|
-
ret[alias.find.toString()] = alias.replacement;
|
|
4232
|
-
}
|
|
4233
|
-
return ret;
|
|
4234
|
-
}, {}) : context.config.build.alias : {}),
|
|
4235
|
-
inject: inject && Object.keys(inject).length > 0 ? [
|
|
4236
|
-
joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")
|
|
4237
|
-
] : void 0
|
|
4238
|
-
}, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
|
|
4239
|
-
"alias",
|
|
4240
|
-
"inject",
|
|
4241
|
-
"external",
|
|
4242
|
-
"noExternal",
|
|
4243
|
-
"skipNodeModulesBundle",
|
|
4244
|
-
"extensions"
|
|
4245
|
-
]) : {}, {
|
|
4246
|
-
mainFields: context.config.build.mainFields,
|
|
4247
|
-
conditions: context.config.build.conditions,
|
|
4248
|
-
define: context.config.build.define,
|
|
4249
|
-
resolveExtensions: context.config.build.extensions,
|
|
4250
|
-
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
4251
|
-
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
4252
|
-
platform: context.config.build.platform,
|
|
4253
|
-
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
4254
|
-
outdir: context.config.output.distPath,
|
|
4255
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
4256
|
-
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
4257
|
-
}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
|
|
4258
|
-
"alias",
|
|
4259
|
-
"inject",
|
|
4260
|
-
"external",
|
|
4261
|
-
"noExternal",
|
|
4262
|
-
"skipNodeModulesBundle",
|
|
4263
|
-
"extensions"
|
|
4264
|
-
]) : {}, {
|
|
4265
|
-
minify: context.config.mode !== "development",
|
|
4266
|
-
metafile: context.config.mode === "development",
|
|
4267
|
-
sourcemap: context.config.mode === "development"
|
|
4268
|
-
}, DEFAULT_ESBUILD_CONFIG);
|
|
4269
|
-
}
|
|
4270
|
-
__name(extractESBuildConfig, "extractESBuildConfig");
|
|
4271
|
-
|
|
4272
|
-
// ../powerlines/src/lib/build/vite.ts
|
|
4273
|
-
var DEFAULT_VITE_CONFIG = {
|
|
4274
|
-
resolve: {
|
|
4275
|
-
extensions: [
|
|
4276
|
-
".mjs",
|
|
4277
|
-
".js",
|
|
4278
|
-
".mts",
|
|
4279
|
-
".ts",
|
|
4280
|
-
".jsx",
|
|
4281
|
-
".tsx",
|
|
4282
|
-
".json"
|
|
4283
|
-
]
|
|
4284
|
-
},
|
|
4285
|
-
json: {
|
|
4286
|
-
stringify: true
|
|
4287
|
-
},
|
|
4288
|
-
logLevel: "silent",
|
|
4289
|
-
clearScreen: true
|
|
4290
|
-
};
|
|
4291
|
-
function extractViteConfig(context) {
|
|
4292
|
-
return defu5({
|
|
4293
|
-
resolve: {
|
|
4294
|
-
alias: context.builtins.reduce((ret, id) => {
|
|
4295
|
-
if (!ret.find((e) => e.find === id)) {
|
|
4296
|
-
const path = context.fs.ids[id];
|
|
4297
|
-
if (path) {
|
|
4298
|
-
ret.push({
|
|
4299
|
-
find: id,
|
|
4300
|
-
replacement: path
|
|
4301
|
-
});
|
|
4302
|
-
}
|
|
4303
|
-
}
|
|
4304
|
-
return ret;
|
|
4305
|
-
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
4306
|
-
if (!ret.find((e) => e.find === id)) {
|
|
4307
|
-
ret.push({
|
|
4308
|
-
find: id,
|
|
4309
|
-
replacement: path
|
|
4310
|
-
});
|
|
4311
|
-
}
|
|
4312
|
-
return ret;
|
|
4313
|
-
}, []) : []),
|
|
4314
|
-
dedupe: context.config.build.dedupe,
|
|
4315
|
-
mainFields: context.config.build.mainFields,
|
|
4316
|
-
conditions: context.config.build.conditions,
|
|
4317
|
-
extensions: context.config.build.extensions
|
|
4318
|
-
}
|
|
4319
|
-
}, context.config.build.variant === "vite" ? context.config.build.override : {}, {
|
|
4320
|
-
define: context.config.build.define,
|
|
4321
|
-
rootDir: context.config.sourceRoot,
|
|
4322
|
-
platform: context.config.build.platform,
|
|
4323
|
-
mode: context.config.mode === "development" ? "development" : "production",
|
|
4324
|
-
cacheDir: joinPaths$1(context.cachePath, "vite"),
|
|
4325
|
-
build: {
|
|
4326
|
-
outDir: context.config.output.distPath,
|
|
4327
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
4328
|
-
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
4329
|
-
},
|
|
4330
|
-
esbuild: extractESBuildConfig(context),
|
|
4331
|
-
logLevel: context.config.logLevel ?? void 0,
|
|
4332
|
-
envDir: context.config.projectRoot
|
|
4333
|
-
}, context.config.build.variant === "vite" ? context.config.build : {}, {
|
|
4334
|
-
build: {
|
|
4335
|
-
minify: context.config.mode !== "development",
|
|
4336
|
-
metafile: context.config.mode === "development",
|
|
4337
|
-
sourcemap: context.config.mode === "development"
|
|
4338
|
-
}
|
|
4339
|
-
}, DEFAULT_VITE_CONFIG);
|
|
4340
|
-
}
|
|
4341
|
-
__name(extractViteConfig, "extractViteConfig");
|
|
4342
|
-
function getString(code) {
|
|
4343
|
-
if (!code) {
|
|
4344
|
-
return "";
|
|
4345
|
-
}
|
|
4346
|
-
if (isString(code)) {
|
|
4347
|
-
return code;
|
|
4348
|
-
}
|
|
4349
|
-
if (isSetObject(code) && "code" in code) {
|
|
4350
|
-
return code.code;
|
|
4351
|
-
}
|
|
4352
|
-
return code.toString();
|
|
4353
|
-
}
|
|
4354
|
-
__name(getString, "getString");
|
|
4355
|
-
var NON_NODE_MODULE_REGEX = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
|
|
4356
|
-
async function handleResolveId(context, args, options = {}) {
|
|
4357
|
-
if (args.id) {
|
|
4358
|
-
if (context.fs.isVirtual(args.id) || args.importer && context.fs.isVirtual(args.id, {
|
|
4359
|
-
paths: [
|
|
4360
|
-
args.importer
|
|
4361
|
-
]
|
|
4362
|
-
})) {
|
|
4363
|
-
const resolvedPath = args.importer ? context.fs.resolve(args.id, {
|
|
4364
|
-
paths: [
|
|
4365
|
-
args.importer
|
|
4366
|
-
]
|
|
4367
|
-
}) : context.fs.resolve(args.id);
|
|
4368
|
-
if (resolvedPath) {
|
|
4369
|
-
return {
|
|
4370
|
-
id: resolvedPath,
|
|
4371
|
-
external: context.config.projectType !== "application"
|
|
4372
|
-
};
|
|
4373
|
-
}
|
|
4374
|
-
}
|
|
4375
|
-
if (!!context.tsconfig.options.paths && Object.keys(context.tsconfig.options.paths).some((path) => args.id.startsWith(path.replaceAll("*", "")))) {
|
|
4376
|
-
let tsconfigPath = false;
|
|
4377
|
-
if (context.tsconfig.options.paths) {
|
|
4378
|
-
for (const tsconfigPathKey of Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")))) {
|
|
4379
|
-
const resolvedPath = context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath2) => context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, tsconfigPath2.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || context.fs.formatPath(tsconfigPath2) === context.fs.formatPath(args.id));
|
|
4380
|
-
if (resolvedPath) {
|
|
4381
|
-
tsconfigPath = context.fs.formatPath(resolvedPath) === context.fs.formatPath(args.id) ? context.fs.formatPath(resolvedPath) : context.fs.resolve(joinPaths(context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), "")));
|
|
4382
|
-
}
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
let tsconfigPathPackage = false;
|
|
4386
|
-
if (context.tsconfig.options.paths) {
|
|
4387
|
-
const tsconfigPathKeys = Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")));
|
|
4388
|
-
if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
|
|
4389
|
-
tsconfigPathPackage = tsconfigPathKeys[0].replace(/\/\*$/, "");
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
if (tsconfigPath && tsconfigPathPackage) {
|
|
4393
|
-
return {
|
|
4394
|
-
id: tsconfigPath,
|
|
4395
|
-
external: Boolean(!options.noExternal?.includes(tsconfigPathPackage) && (options.external?.includes(tsconfigPathPackage) ?? context.config.projectType !== "application"))
|
|
4396
|
-
};
|
|
4397
|
-
}
|
|
4398
|
-
}
|
|
4399
|
-
if (options.skipResolve) {
|
|
4400
|
-
return void 0;
|
|
4401
|
-
}
|
|
4402
|
-
if (options.skipNodeModulesBundle) {
|
|
4403
|
-
if (match(args.id, options.resolvePatterns) || match(args.id, options.noExternal) || args.id.startsWith("internal:") || args.id.startsWith("virtual:")) {
|
|
4404
|
-
return void 0;
|
|
4405
|
-
}
|
|
4406
|
-
if (match(args.id, options.external) || args.id.startsWith("node:")) {
|
|
4407
|
-
return {
|
|
4408
|
-
id: args.id,
|
|
4409
|
-
external: true
|
|
4410
|
-
};
|
|
4411
|
-
}
|
|
4412
|
-
if (!NON_NODE_MODULE_REGEX.test(args.id)) {
|
|
4413
|
-
return {
|
|
4414
|
-
id: args.id,
|
|
4415
|
-
external: true
|
|
4416
|
-
};
|
|
4417
|
-
}
|
|
4418
|
-
} else {
|
|
4419
|
-
const resolvedPath = context.fs.resolve(args.id, {
|
|
4420
|
-
paths: args.importer ? [
|
|
4421
|
-
args.importer
|
|
4422
|
-
] : []
|
|
4423
|
-
});
|
|
4424
|
-
if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
|
|
4425
|
-
return void 0;
|
|
4426
|
-
}
|
|
4427
|
-
if (match(args.id, options.external) || args.id.startsWith("node:")) {
|
|
4428
|
-
return {
|
|
4429
|
-
id: args.id,
|
|
4430
|
-
external: true
|
|
4431
|
-
};
|
|
4432
|
-
}
|
|
4433
|
-
}
|
|
4434
|
-
}
|
|
4435
|
-
return void 0;
|
|
4436
|
-
}
|
|
4437
|
-
__name(handleResolveId, "handleResolveId");
|
|
4438
|
-
|
|
4439
|
-
// ../powerlines/src/lib/unplugin/factory.ts
|
|
4440
|
-
function createUnpluginFactory(variant, decorate) {
|
|
4441
|
-
return (config, meta) => {
|
|
4442
|
-
const log = createLog("unplugin", config);
|
|
4443
|
-
log(LogLevelLabel.DEBUG, "Initializing Unplugin");
|
|
4444
|
-
try {
|
|
4445
|
-
const userConfig = {
|
|
4446
|
-
...config,
|
|
4447
|
-
variant,
|
|
4448
|
-
unplugin: meta
|
|
4449
|
-
};
|
|
4450
|
-
let api;
|
|
4451
|
-
let resolvePatterns = [];
|
|
4452
|
-
async function buildStart() {
|
|
4453
|
-
log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
4454
|
-
const workspaceRoot = getWorkspaceRoot(process.cwd());
|
|
4455
|
-
api = await PowerlinesAPI.from(workspaceRoot, userConfig);
|
|
4456
|
-
if (api.context.config.build.skipNodeModulesBundle) {
|
|
4457
|
-
resolvePatterns = tsconfigPathsToRegExp(api.context.tsconfig.options.paths ?? []);
|
|
4458
|
-
}
|
|
4459
|
-
log(LogLevelLabel.DEBUG, "Preparing build artifacts for the Powerlines project...");
|
|
4460
|
-
await api.prepare({
|
|
4461
|
-
command: "build"
|
|
4462
|
-
});
|
|
4463
|
-
}
|
|
4464
|
-
__name(buildStart, "buildStart");
|
|
4465
|
-
async function resolveId(id, importer, options = {
|
|
4466
|
-
isEntry: false
|
|
4467
|
-
}) {
|
|
4468
|
-
return handleResolveId(api.context, {
|
|
4469
|
-
id,
|
|
4470
|
-
importer,
|
|
4471
|
-
options
|
|
4472
|
-
}, {
|
|
4473
|
-
skipNodeModulesBundle: api.context.config.build.skipNodeModulesBundle,
|
|
4474
|
-
external: api.context.config.build.external,
|
|
4475
|
-
noExternal: api.context.config.build.noExternal,
|
|
4476
|
-
resolvePatterns
|
|
4477
|
-
});
|
|
4478
|
-
}
|
|
4479
|
-
__name(resolveId, "resolveId");
|
|
4480
|
-
async function load(id) {
|
|
4481
|
-
const environment = await api.context.getEnvironment();
|
|
4482
|
-
if (id) {
|
|
4483
|
-
const resolvedPath = environment.fs.resolve(id);
|
|
4484
|
-
if (resolvedPath) {
|
|
4485
|
-
return environment.fs.readFile(resolvedPath);
|
|
4486
|
-
}
|
|
4487
|
-
}
|
|
4488
|
-
let result2 = await api.callPreHook(environment, "load", id);
|
|
4489
|
-
if (result2) {
|
|
4490
|
-
return result2;
|
|
4491
|
-
}
|
|
4492
|
-
result2 = await api.callNormalHook(environment, "load", id);
|
|
4493
|
-
if (result2) {
|
|
4494
|
-
return result2;
|
|
4495
|
-
}
|
|
4496
|
-
return api.callPostHook(environment, "load", id);
|
|
4497
|
-
}
|
|
4498
|
-
__name(load, "load");
|
|
4499
|
-
async function transform(code, id) {
|
|
4500
|
-
const environment = await api.context.getEnvironment();
|
|
4501
|
-
let transformed = code;
|
|
4502
|
-
let result2 = await api.callPreHook(environment, "transform", getString(transformed), id);
|
|
4503
|
-
if (result2) {
|
|
4504
|
-
transformed = result2;
|
|
4505
|
-
}
|
|
4506
|
-
result2 = await api.callNormalHook(environment, "transform", getString(transformed), id);
|
|
4507
|
-
if (result2) {
|
|
4508
|
-
transformed = result2;
|
|
4509
|
-
}
|
|
4510
|
-
result2 = await api.callPostHook(environment, "transform", getString(transformed), id);
|
|
4511
|
-
if (result2) {
|
|
4512
|
-
transformed = result2;
|
|
4513
|
-
}
|
|
4514
|
-
return transformed;
|
|
4515
|
-
}
|
|
4516
|
-
__name(transform, "transform");
|
|
4517
|
-
async function writeBundle() {
|
|
4518
|
-
log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
4519
|
-
const environment = await api.context.getEnvironment();
|
|
4520
|
-
await api.callHook(environment, "writeBundle");
|
|
4521
|
-
}
|
|
4522
|
-
__name(writeBundle, "writeBundle");
|
|
4523
|
-
const result = {
|
|
4524
|
-
name: "powerlines",
|
|
4525
|
-
api,
|
|
4526
|
-
resolveId: {
|
|
4527
|
-
filter: {
|
|
4528
|
-
id: {
|
|
4529
|
-
include: [
|
|
4530
|
-
/.*/
|
|
4531
|
-
]
|
|
4532
|
-
}
|
|
4533
|
-
},
|
|
4534
|
-
handler: resolveId
|
|
4535
|
-
},
|
|
4536
|
-
load: {
|
|
4537
|
-
filter: {
|
|
4538
|
-
id: {
|
|
4539
|
-
include: [
|
|
4540
|
-
/.*/,
|
|
4541
|
-
/^storm:/
|
|
4542
|
-
]
|
|
4543
|
-
}
|
|
4544
|
-
},
|
|
4545
|
-
handler: load
|
|
4546
|
-
},
|
|
4547
|
-
transform,
|
|
4548
|
-
buildStart,
|
|
4549
|
-
writeBundle
|
|
4550
|
-
};
|
|
4551
|
-
return decorate ? decorate(api, result) : result;
|
|
4552
|
-
} catch (error) {
|
|
4553
|
-
log(LogLevelLabel.FATAL, error?.message);
|
|
4554
|
-
throw error;
|
|
4555
|
-
}
|
|
4556
|
-
};
|
|
4557
|
-
}
|
|
4558
|
-
__name(createUnpluginFactory, "createUnpluginFactory");
|
|
4559
|
-
|
|
4560
|
-
// ../powerlines/src/vite.ts
|
|
4561
|
-
var vite = createVitePlugin(createUnpluginFactory("vite", (api, plugin) => {
|
|
4562
|
-
return {
|
|
4563
|
-
...plugin,
|
|
4564
|
-
vite: {
|
|
4565
|
-
sharedDuringBuild: true,
|
|
4566
|
-
async hotUpdate(options) {
|
|
4567
|
-
const environment = await api.context.getEnvironment();
|
|
4568
|
-
return api.callHook(environment, "vite:hotUpdate", options);
|
|
4569
|
-
},
|
|
4570
|
-
async config(config, env) {
|
|
4571
|
-
api.context.config.mode = isDevelopmentMode(env.mode) ? "development" : isTestMode(env.mode) ? "test" : "production";
|
|
4572
|
-
const environment = await api.context.getEnvironment();
|
|
4573
|
-
const result = await api.callHook(environment, "config");
|
|
4574
|
-
return defu5(
|
|
4575
|
-
extractViteConfig(api.context),
|
|
4576
|
-
// Need to use `any` here to avoid excessive type complexity
|
|
4577
|
-
result?.build ?? {},
|
|
4578
|
-
config
|
|
4579
|
-
);
|
|
4580
|
-
},
|
|
4581
|
-
async configResolved(_config) {
|
|
4582
|
-
const environment = await api.context.getEnvironment();
|
|
4583
|
-
await api.callHook(environment, "configResolved");
|
|
4584
|
-
},
|
|
4585
|
-
async configureServer(server) {
|
|
4586
|
-
const environment = await api.context.getEnvironment();
|
|
4587
|
-
return api.callHook(environment, "vite:configureServer", server);
|
|
4588
|
-
},
|
|
4589
|
-
async configurePreviewServer(server) {
|
|
4590
|
-
const environment = await api.context.getEnvironment();
|
|
4591
|
-
return api.callHook(environment, "vite:configurePreviewServer", server);
|
|
4592
|
-
},
|
|
4593
|
-
async transformIndexHtml(html, ctx) {
|
|
4594
|
-
const environment = await api.context.getEnvironment();
|
|
4595
|
-
return api.callHook(environment, "vite:transformIndexHtml", html, ctx);
|
|
4596
|
-
},
|
|
4597
|
-
async handleHotUpdate(ctx) {
|
|
4598
|
-
const environment = await api.context.getEnvironment();
|
|
4599
|
-
return api.callHook(environment, "vite:handleHotUpdate", ctx);
|
|
4600
|
-
}
|
|
4601
|
-
}
|
|
4602
|
-
};
|
|
4603
|
-
}));
|
|
4604
|
-
var vite_default = vite;
|
|
4605
|
-
createEsbuildPlugin(createUnpluginFactory("esbuild", (api, plugin) => {
|
|
4606
|
-
return {
|
|
4607
|
-
...plugin,
|
|
4608
|
-
esbuild: {
|
|
4609
|
-
config: /* @__PURE__ */ __name((options) => {
|
|
4610
|
-
options ??= {};
|
|
4611
|
-
const result = extractESBuildConfig(api.context);
|
|
4612
|
-
for (const key in result) {
|
|
4613
|
-
if (isUndefined(options[key]) && !isUndefined(result[key])) {
|
|
4614
|
-
options[key] = result[key];
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
}, "config"),
|
|
4618
|
-
setup: /* @__PURE__ */ __name(async (build) => {
|
|
4619
|
-
const environment = await api.context.getEnvironment();
|
|
4620
|
-
return api.callHook(environment, "esbuild:setup", build);
|
|
4621
|
-
}, "setup")
|
|
4622
|
-
}
|
|
4623
|
-
};
|
|
4624
|
-
}));
|
|
4625
|
-
var webpack = createWebpackPlugin(createUnpluginFactory("webpack"));
|
|
4626
|
-
var webpack_default = webpack;
|
|
4627
|
-
defineNuxtModule({
|
|
4628
|
-
meta: {
|
|
4629
|
-
name: "powerlines",
|
|
4630
|
-
configKey: "storm"
|
|
4631
|
-
},
|
|
4632
|
-
defaults: {},
|
|
4633
|
-
setup(options, _nuxt) {
|
|
4634
|
-
addVitePlugin(() => vite_default(options));
|
|
4635
|
-
addWebpackPlugin(() => webpack_default(options));
|
|
4636
|
-
}
|
|
4637
|
-
});
|
|
4638
|
-
createRolldownPlugin(createUnpluginFactory("rolldown"));
|
|
4639
|
-
createRollupPlugin(createUnpluginFactory("rollup"));
|
|
4640
|
-
createRspackPlugin(createUnpluginFactory("rspack"));
|
|
4641
|
-
createUnloaderPlugin(createUnpluginFactory("unloader"));
|
|
4642
4182
|
|
|
4643
4183
|
// ../powerlines/src/index.ts
|
|
4644
4184
|
var src_default = PowerlinesAPI;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkACE6O62X_js = require('./chunk-ACE6O62X.js');
|
|
4
4
|
var chunkVIU4CXA3_js = require('./chunk-VIU4CXA3.js');
|
|
5
5
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
6
6
|
var devkit = require('@nx/devkit');
|
|
@@ -60,7 +60,7 @@ function createNxPlugin(opts) {
|
|
|
60
60
|
}
|
|
61
61
|
const root = pluginHelpers.getRoot(projectRoot, context);
|
|
62
62
|
const cacheDir = joinPaths.joinPaths(envPaths.cache, "nx-plugin", murmurhash.murmurhash(contextV2.workspaceRoot, {
|
|
63
|
-
maxLength:
|
|
63
|
+
maxLength: chunkACE6O62X_js.PROJECT_ROOT_HASH_LENGTH
|
|
64
64
|
}));
|
|
65
65
|
const jiti$1 = jiti.createJiti(joinPaths.joinPaths(contextV2.workspaceRoot, projectRoot), {
|
|
66
66
|
interopDefault: true,
|
|
@@ -68,7 +68,7 @@ function createNxPlugin(opts) {
|
|
|
68
68
|
moduleCache: true
|
|
69
69
|
});
|
|
70
70
|
console.debug(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Loading ${framework} user configuration for project in root directory ${projectRoot}.`);
|
|
71
|
-
const userConfig = await
|
|
71
|
+
const userConfig = await chunkACE6O62X_js.loadUserConfigFile(projectRoot, contextV2.workspaceRoot, jiti$1, "build", "development", configFile, framework);
|
|
72
72
|
if (!exists.existsSync(joinPaths.joinPaths(contextV2.workspaceRoot, projectRoot, "package.json"))) {
|
|
73
73
|
console.warn(`[${name}] - ${(/* @__PURE__ */ new Date()).toISOString()} - Cannot find \`package.json\` file in the project's root directory (path: "${joinPaths.joinPaths(contextV2.workspaceRoot, projectRoot)}"). Skipping project configuration.`);
|
|
74
74
|
return {};
|
|
@@ -133,8 +133,8 @@ function createNxPlugin(opts) {
|
|
|
133
133
|
executor: options?.prepare?.executor || `@${framework}/nx:${options?.prepare?.targetName || "prepare"}`,
|
|
134
134
|
dependsOn: [
|
|
135
135
|
`^${options?.prepare?.targetName || "prepare"}`,
|
|
136
|
-
"clean"
|
|
137
|
-
],
|
|
136
|
+
options?.clean !== false && `${options?.clean?.targetName || "clean"}`
|
|
137
|
+
].filter(Boolean),
|
|
138
138
|
defaultConfiguration: options?.prepare?.defaultConfiguration || "production",
|
|
139
139
|
options: {
|
|
140
140
|
entry: userConfig.entry || "{sourceRoot}/index.ts",
|
|
@@ -168,7 +168,7 @@ function createNxPlugin(opts) {
|
|
|
168
168
|
executor: options?.build?.executor || `@${framework}/nx:${options?.build?.targetName || "build"}`,
|
|
169
169
|
dependsOn: [
|
|
170
170
|
`^${options?.build?.targetName || "build"}`,
|
|
171
|
-
options?.prepare !== false &&
|
|
171
|
+
options?.prepare !== false && `${options?.prepare?.targetName || "prepare"}`
|
|
172
172
|
].filter(Boolean),
|
|
173
173
|
defaultConfiguration: options?.build?.defaultConfiguration || "production",
|
|
174
174
|
options: {
|
|
@@ -210,7 +210,7 @@ function createNxPlugin(opts) {
|
|
|
210
210
|
executor: options?.lint?.executor || `@${framework}/nx:${options?.lint?.targetName || "lint"}`,
|
|
211
211
|
dependsOn: [
|
|
212
212
|
`^${options?.lint?.targetName || "lint"}`,
|
|
213
|
-
options?.prepare !== false &&
|
|
213
|
+
options?.prepare !== false && `${options?.prepare?.targetName || "prepare"}`
|
|
214
214
|
].filter(Boolean),
|
|
215
215
|
defaultConfiguration: options?.lint?.defaultConfiguration || "production",
|
|
216
216
|
options: {
|
|
@@ -251,7 +251,7 @@ function createNxPlugin(opts) {
|
|
|
251
251
|
executor: options?.docs?.executor || `@${framework}/nx:${options?.docs?.targetName || "docs"}`,
|
|
252
252
|
dependsOn: [
|
|
253
253
|
`^${options?.docs?.targetName || "docs"}`,
|
|
254
|
-
options?.build !== false &&
|
|
254
|
+
options?.build !== false && `${options?.build?.targetName || "build"}`
|
|
255
255
|
].filter(Boolean),
|
|
256
256
|
defaultConfiguration: options?.docs?.defaultConfiguration || "production",
|
|
257
257
|
options: {
|
|
@@ -292,7 +292,7 @@ function createNxPlugin(opts) {
|
|
|
292
292
|
executor: options?.deploy?.executor || `@${framework}/nx:${options?.deploy?.targetName || "deploy"}`,
|
|
293
293
|
dependsOn: [
|
|
294
294
|
`^${options?.deploy?.targetName || "deploy"}`,
|
|
295
|
-
options?.build !== false &&
|
|
295
|
+
options?.build !== false && `${options?.build?.targetName || "build"}`
|
|
296
296
|
].filter(Boolean),
|
|
297
297
|
defaultConfiguration: options?.deploy?.defaultConfiguration || "production",
|
|
298
298
|
options: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2SFOQMAA_js = require('./chunk-2SFOQMAA.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
|
|
6
6
|
// src/executors/clean/executor.ts
|
|
@@ -11,7 +11,7 @@ async function executorFn(context, api) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
chunkSHUYVCID_js.__name(executorFn, "executorFn");
|
|
14
|
-
var executor =
|
|
14
|
+
var executor = chunk2SFOQMAA_js.withExecutor("clean", executorFn);
|
|
15
15
|
var executor_default = executor;
|
|
16
16
|
|
|
17
17
|
exports.executorFn = executorFn;
|