@powerlines/nx 0.10.8 → 0.10.10
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 +22 -0
- package/dist/{chunk-3WPWHDP3.mjs → chunk-72SMJRRS.mjs} +81 -17
- package/dist/{chunk-R4LYPNZD.mjs → chunk-AO7OQ26C.mjs} +1 -1
- package/dist/{chunk-B3UMNKEM.js → chunk-CYH2EFG7.js} +2 -2
- package/dist/{chunk-VP7AMTR6.js → chunk-EOLGFIVC.js} +2 -2
- package/dist/{chunk-6QJOYEGY.js → chunk-L5RBARDS.js} +8 -9
- package/dist/{chunk-WUF54G5K.js → chunk-MCZLD3NY.js} +81 -17
- package/dist/{chunk-4S5RU53T.js → chunk-NXUUFBCT.js} +2 -2
- package/dist/{chunk-T52ZTHWM.mjs → chunk-ODVN2Q6Y.mjs} +1 -1
- package/dist/{chunk-QJEIBIEZ.js → chunk-OUNXRMS7.js} +2 -2
- package/dist/{chunk-GQKX6RIX.mjs → chunk-QWEMU3V4.mjs} +9 -9
- package/dist/{chunk-AX3G6RLK.mjs → chunk-RJP4IZYY.mjs} +1 -1
- package/dist/{chunk-IUHTUUDE.js → chunk-UMVPNWWR.js} +2 -2
- package/dist/{chunk-3TWAKTYR.mjs → chunk-XO3MCKAF.mjs} +1 -1
- package/dist/{chunk-M647TAWI.mjs → chunk-Y4AEEMCT.mjs} +1 -1
- package/dist/executors.js +11 -11
- package/dist/executors.mjs +6 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -17
- package/dist/index.mjs +7 -7
- package/dist/src/base/base-executor.js +2 -2
- package/dist/src/base/base-executor.mjs +1 -1
- package/dist/src/executors/build/executor.js +4 -4
- package/dist/src/executors/build/executor.mjs +2 -2
- package/dist/src/executors/build/schema.d.ts +85 -0
- package/dist/src/executors/build/schema.json +96 -0
- package/dist/src/executors/clean/executor.js +4 -4
- package/dist/src/executors/clean/executor.mjs +2 -2
- package/dist/src/executors/clean/schema.d.ts +75 -0
- package/dist/src/executors/clean/schema.json +77 -0
- package/dist/src/executors/docs/executor.js +4 -4
- package/dist/src/executors/docs/executor.mjs +2 -2
- package/dist/src/executors/docs/schema.d.ts +75 -0
- package/dist/src/executors/docs/schema.json +77 -0
- package/dist/src/executors/lint/executor.js +4 -4
- package/dist/src/executors/lint/executor.mjs +2 -2
- package/dist/src/executors/lint/schema.d.ts +75 -0
- package/dist/src/executors/lint/schema.json +77 -0
- package/dist/src/executors/prepare/executor.js +4 -4
- package/dist/src/executors/prepare/executor.mjs +2 -2
- package/dist/src/executors/prepare/schema.d.ts +75 -0
- package/dist/src/executors/prepare/schema.json +77 -0
- package/dist/src/generators/sync/schema.d.ts +15 -0
- package/dist/src/generators/sync/schema.json +19 -0
- package/dist/src/plugin/index.d.mts +3 -4
- package/dist/src/plugin/index.d.ts +3 -4
- package/dist/src/plugin/index.js +2 -6
- package/dist/src/plugin/index.mjs +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Powerlines - Nx
|
|
4
4
|
|
|
5
|
+
## [0.10.9](https://github.com/storm-software/powerlines/releases/tag/nx%400.10.9) (11/16/2025)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- **powerlines:** Added debug initialization logging for the Nx plugin
|
|
10
|
+
([845b5db](https://github.com/storm-software/powerlines/commit/845b5db))
|
|
11
|
+
|
|
12
|
+
### Updated Dependencies
|
|
13
|
+
|
|
14
|
+
- Updated **powerlines** to **v0.19.5**
|
|
15
|
+
|
|
16
|
+
## [0.10.8](https://github.com/storm-software/powerlines/releases/tag/nx%400.10.8) (11/16/2025)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **nx:** Resolved issue with selecting config files in Nx plugin
|
|
21
|
+
([0f3535f](https://github.com/storm-software/powerlines/commit/0f3535f))
|
|
22
|
+
|
|
23
|
+
### Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated **powerlines** to **v0.19.4**
|
|
26
|
+
|
|
5
27
|
## [0.10.7](https://github.com/storm-software/powerlines/releases/tag/nx%400.10.7) (11/12/2025)
|
|
6
28
|
|
|
7
29
|
### Updated Dependencies
|
|
@@ -66,6 +66,7 @@ import { loadTsConfig } from '@stryke/fs/tsconfig';
|
|
|
66
66
|
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
67
67
|
import { isDevelopmentMode, isTestMode } from '@stryke/env/environment-checks';
|
|
68
68
|
import { createVitePlugin, createEsbuildPlugin, createWebpackPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnloaderPlugin } from 'unplugin';
|
|
69
|
+
import { camelCase } from '@stryke/string-format/camel-case';
|
|
69
70
|
import { match, tsconfigPathsToRegExp } from 'bundle-require';
|
|
70
71
|
import '@stryke/fs/read-file';
|
|
71
72
|
import 'magic-string';
|
|
@@ -1673,7 +1674,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1673
1674
|
lint: config.lint,
|
|
1674
1675
|
transform: config.transform,
|
|
1675
1676
|
build: config.build,
|
|
1676
|
-
override: config.override,
|
|
1677
1677
|
framework: config.framework
|
|
1678
1678
|
};
|
|
1679
1679
|
}
|
|
@@ -2175,9 +2175,9 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2175
2175
|
eslint: {}
|
|
2176
2176
|
},
|
|
2177
2177
|
build: {
|
|
2178
|
-
target: "esnext"
|
|
2179
|
-
|
|
2180
|
-
|
|
2178
|
+
target: "esnext",
|
|
2179
|
+
override: {}
|
|
2180
|
+
}
|
|
2181
2181
|
});
|
|
2182
2182
|
}
|
|
2183
2183
|
this.config.entry = getUniqueEntries(this.config.entry);
|
|
@@ -3587,6 +3587,43 @@ var DEFAULT_ESBUILD_CONFIG = {
|
|
|
3587
3587
|
logLevel: "silent"
|
|
3588
3588
|
};
|
|
3589
3589
|
function extractESBuildConfig(context) {
|
|
3590
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
3591
|
+
if (inject && Object.keys(inject).length > 0) {
|
|
3592
|
+
context.fs.writeFileSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
3593
|
+
if (value) {
|
|
3594
|
+
if (Array.isArray(value)) {
|
|
3595
|
+
if (camelCase(key) !== key) {
|
|
3596
|
+
if (value.length === 1) {
|
|
3597
|
+
return `
|
|
3598
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
3599
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
3600
|
+
} else if (value.length > 1) {
|
|
3601
|
+
return `
|
|
3602
|
+
import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
|
|
3603
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
3604
|
+
}
|
|
3605
|
+
} else if (value.length === 1) {
|
|
3606
|
+
return `
|
|
3607
|
+
import ${key} from "${value[0]}";
|
|
3608
|
+
export { ${key} };`;
|
|
3609
|
+
} else if (value.length > 1) {
|
|
3610
|
+
return `
|
|
3611
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
3612
|
+
export { ${key} };`;
|
|
3613
|
+
}
|
|
3614
|
+
} else if (camelCase(key) !== key) {
|
|
3615
|
+
return `
|
|
3616
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
3617
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
3618
|
+
} else {
|
|
3619
|
+
return `
|
|
3620
|
+
import ${key} from "${value}";
|
|
3621
|
+
export { ${key} };`;
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
return "";
|
|
3625
|
+
}).join("\n"));
|
|
3626
|
+
}
|
|
3590
3627
|
return defu3({
|
|
3591
3628
|
alias: context.builtins.reduce((ret, id) => {
|
|
3592
3629
|
const path = context.fs.ids[id];
|
|
@@ -3594,15 +3631,37 @@ function extractESBuildConfig(context) {
|
|
|
3594
3631
|
ret[id] = path;
|
|
3595
3632
|
}
|
|
3596
3633
|
return ret;
|
|
3597
|
-
}, {})
|
|
3598
|
-
|
|
3634
|
+
}, context.config.build.override.alias ?? context.config.build.alias ?? {}),
|
|
3635
|
+
inject: inject && Object.keys(inject).length > 0 ? [
|
|
3636
|
+
joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")
|
|
3637
|
+
] : void 0
|
|
3638
|
+
}, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
|
|
3639
|
+
"alias",
|
|
3640
|
+
"inject",
|
|
3641
|
+
"external",
|
|
3642
|
+
"noExternal",
|
|
3643
|
+
"skipNodeModulesBundle",
|
|
3644
|
+
"extensions"
|
|
3645
|
+
]) : {}, {
|
|
3646
|
+
mainFields: context.config.build.mainFields,
|
|
3647
|
+
conditions: context.config.build.conditions,
|
|
3648
|
+
define: context.config.build.define,
|
|
3649
|
+
resolveExtensions: context.config.build.extensions,
|
|
3650
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
3599
3651
|
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
3600
3652
|
platform: context.config.build.platform,
|
|
3601
3653
|
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
3602
3654
|
outdir: context.config.output.outputPath,
|
|
3603
3655
|
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
3604
3656
|
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
3605
|
-
}, context.config.build.variant === "esbuild" ? context.config.build
|
|
3657
|
+
}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
|
|
3658
|
+
"alias",
|
|
3659
|
+
"inject",
|
|
3660
|
+
"external",
|
|
3661
|
+
"noExternal",
|
|
3662
|
+
"skipNodeModulesBundle",
|
|
3663
|
+
"extensions"
|
|
3664
|
+
]) : {}, {
|
|
3606
3665
|
minify: context.config.mode !== "development",
|
|
3607
3666
|
metafile: context.config.mode === "development",
|
|
3608
3667
|
sourcemap: context.config.mode === "development"
|
|
@@ -3638,13 +3697,14 @@ function extractViteConfig(context) {
|
|
|
3638
3697
|
ret[id] = path;
|
|
3639
3698
|
}
|
|
3640
3699
|
return ret;
|
|
3641
|
-
}, {})
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
}, {
|
|
3700
|
+
}, {}),
|
|
3701
|
+
dedupe: context.config.build.dedupe,
|
|
3702
|
+
mainFields: context.config.build.mainFields,
|
|
3703
|
+
conditions: context.config.build.conditions,
|
|
3704
|
+
extensions: context.config.build.extensions
|
|
3705
|
+
}
|
|
3706
|
+
}, context.config.build.variant === "vite" ? context.config.build.override : {}, {
|
|
3707
|
+
define: context.config.build.define,
|
|
3648
3708
|
rootDir: context.config.sourceRoot,
|
|
3649
3709
|
platform: context.config.build.platform,
|
|
3650
3710
|
mode: context.config.mode === "development" ? "development" : "production",
|
|
@@ -3656,8 +3716,7 @@ function extractViteConfig(context) {
|
|
|
3656
3716
|
},
|
|
3657
3717
|
esbuild: extractESBuildConfig(context),
|
|
3658
3718
|
logLevel: context.config.logLevel ?? void 0,
|
|
3659
|
-
envDir: context.config.projectRoot
|
|
3660
|
-
noExternal: context.builtins
|
|
3719
|
+
envDir: context.config.projectRoot
|
|
3661
3720
|
}, context.config.build.variant === "vite" ? context.config.build : {}, {
|
|
3662
3721
|
build: {
|
|
3663
3722
|
minify: context.config.mode !== "development",
|
|
@@ -3884,7 +3943,12 @@ var vite = createVitePlugin(createUnpluginFactory("vite", (api, plugin) => {
|
|
|
3884
3943
|
api.context.config.mode = isDevelopmentMode(env.mode) ? "development" : isTestMode(env.mode) ? "test" : "production";
|
|
3885
3944
|
const environment = await api.context.getEnvironment();
|
|
3886
3945
|
const result = await api.callHook(environment, "config");
|
|
3887
|
-
return defu3(
|
|
3946
|
+
return defu3(
|
|
3947
|
+
extractViteConfig(api.context),
|
|
3948
|
+
// Need to use `any` here to avoid excessive type complexity
|
|
3949
|
+
result?.build ?? {},
|
|
3950
|
+
config
|
|
3951
|
+
);
|
|
3888
3952
|
},
|
|
3889
3953
|
async configResolved(_config) {
|
|
3890
3954
|
const environment = await api.context.getEnvironment();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMCZLD3NY_js = require('./chunk-MCZLD3NY.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 = chunkMCZLD3NY_js.withExecutor("clean", executorFn);
|
|
15
15
|
var executor_default = executor;
|
|
16
16
|
|
|
17
17
|
exports.executorFn = executorFn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMCZLD3NY_js = require('./chunk-MCZLD3NY.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
|
|
6
6
|
// src/executors/docs/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 = chunkMCZLD3NY_js.withExecutor("docs", executorFn);
|
|
15
15
|
var executor_default = executor;
|
|
16
16
|
|
|
17
17
|
exports.executorFn = executorFn;
|
|
@@ -12,6 +12,7 @@ var json = require('@stryke/fs/json');
|
|
|
12
12
|
var murmurhash = require('@stryke/hash/murmurhash');
|
|
13
13
|
var joinPaths = require('@stryke/path/join-paths');
|
|
14
14
|
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
15
|
+
var titleCase = require('@stryke/string-format/title-case');
|
|
15
16
|
var isError = require('@stryke/type-checks/is-error');
|
|
16
17
|
var defu = require('defu');
|
|
17
18
|
var jiti = require('jiti');
|
|
@@ -62,10 +63,11 @@ function getNxPluginInputs(framework) {
|
|
|
62
63
|
chunkSHUYVCID_js.__name(getNxPluginInputs, "getNxPluginInputs");
|
|
63
64
|
function createNxPlugin(opts) {
|
|
64
65
|
const framework = opts?.framework || "powerlines";
|
|
65
|
-
const
|
|
66
|
+
const name = opts?.name || `${framework}/plugin/nx`;
|
|
66
67
|
const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
|
|
67
68
|
const targetInputs = getNxTargetInputs(framework);
|
|
68
69
|
const pluginInputs = getNxPluginInputs(framework);
|
|
70
|
+
console.debug(`[${name}]: Initializing the ${titleCase.titleCase(framework)} Nx plugin for the following inputs: ${pluginInputs}`);
|
|
69
71
|
return [
|
|
70
72
|
pluginInputs,
|
|
71
73
|
async (configFiles, options, contextV2) => {
|
|
@@ -82,7 +84,7 @@ function createNxPlugin(opts) {
|
|
|
82
84
|
try {
|
|
83
85
|
const projectRoot = pluginHelpers.getProjectRoot(configFile, contextV2.workspaceRoot);
|
|
84
86
|
if (!projectRoot) {
|
|
85
|
-
console.error(`[${
|
|
87
|
+
console.error(`[${name}]: package.json and ${framework} configuration files (i.e. ${framework}.config.ts) must be located in the project root directory: ${configFile}`);
|
|
86
88
|
return {};
|
|
87
89
|
}
|
|
88
90
|
const root = pluginHelpers.getRoot(projectRoot, context);
|
|
@@ -97,12 +99,12 @@ function createNxPlugin(opts) {
|
|
|
97
99
|
const userConfig = await chunkUOTRU26N_js.loadUserConfigFile(projectRoot, jiti$1, "build", "development", configFile, framework);
|
|
98
100
|
const packageJson = json.readJsonFileSync(joinPaths.joinPaths(projectRoot, "package.json"));
|
|
99
101
|
if (!userConfig.configFile && !packageJson.storm) {
|
|
100
|
-
console.debug(`[${
|
|
102
|
+
console.debug(`[${name}]: Skipping ${projectRoot} - no ${framework} configuration found for project in root directory.`);
|
|
101
103
|
return {};
|
|
102
104
|
}
|
|
103
105
|
const projectConfig = pluginHelpers.getProjectConfigFromProjectRoot(projectRoot, packageJson);
|
|
104
106
|
if (!projectConfig) {
|
|
105
|
-
console.warn(`[${
|
|
107
|
+
console.warn(`[${name}]: No project configuration found for project in root directory ${projectRoot}`);
|
|
106
108
|
return {};
|
|
107
109
|
}
|
|
108
110
|
const tsconfig = userConfig?.tsconfig || (exists.existsSync(joinPaths.joinPaths(projectRoot, "tsconfig.json")) ? joinPaths.joinPaths(projectRoot, "tsconfig.json") : void 0);
|
|
@@ -291,7 +293,7 @@ function createNxPlugin(opts) {
|
|
|
291
293
|
}
|
|
292
294
|
};
|
|
293
295
|
}
|
|
294
|
-
projectTags.setDefaultProjectTags(projectConfig,
|
|
296
|
+
projectTags.setDefaultProjectTags(projectConfig, name);
|
|
295
297
|
projectTags.addProjectTag(projectConfig, framework, projectConfig.projectType || userConfig.type || "library", {
|
|
296
298
|
overwrite: true
|
|
297
299
|
});
|
|
@@ -307,7 +309,7 @@ function createNxPlugin(opts) {
|
|
|
307
309
|
}
|
|
308
310
|
};
|
|
309
311
|
} catch (error) {
|
|
310
|
-
console.error(`[${
|
|
312
|
+
console.error(`[${name}]: ${isError.isError(error) ? error.message : "Unknown fatal error"}`);
|
|
311
313
|
return {};
|
|
312
314
|
}
|
|
313
315
|
}, configFiles, options, contextV2);
|
|
@@ -317,11 +319,8 @@ function createNxPlugin(opts) {
|
|
|
317
319
|
chunkSHUYVCID_js.__name(createNxPlugin, "createNxPlugin");
|
|
318
320
|
|
|
319
321
|
// src/plugin/index.ts
|
|
320
|
-
var name = "powerlines/nx/plugin";
|
|
321
322
|
var createNodesV2 = createNxPlugin({
|
|
322
|
-
name,
|
|
323
323
|
framework: "powerlines"
|
|
324
324
|
});
|
|
325
325
|
|
|
326
326
|
exports.createNodesV2 = createNodesV2;
|
|
327
|
-
exports.name = name;
|
|
@@ -68,6 +68,7 @@ var tsconfig = require('@stryke/fs/tsconfig');
|
|
|
68
68
|
var writeFile$1 = require('@stryke/fs/write-file');
|
|
69
69
|
var environmentChecks = require('@stryke/env/environment-checks');
|
|
70
70
|
var unplugin = require('unplugin');
|
|
71
|
+
var camelCase = require('@stryke/string-format/camel-case');
|
|
71
72
|
var bundleRequire = require('bundle-require');
|
|
72
73
|
require('@stryke/fs/read-file');
|
|
73
74
|
require('magic-string');
|
|
@@ -1703,7 +1704,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1703
1704
|
lint: config.lint,
|
|
1704
1705
|
transform: config.transform,
|
|
1705
1706
|
build: config.build,
|
|
1706
|
-
override: config.override,
|
|
1707
1707
|
framework: config.framework
|
|
1708
1708
|
};
|
|
1709
1709
|
}
|
|
@@ -2205,9 +2205,9 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2205
2205
|
eslint: {}
|
|
2206
2206
|
},
|
|
2207
2207
|
build: {
|
|
2208
|
-
target: "esnext"
|
|
2209
|
-
|
|
2210
|
-
|
|
2208
|
+
target: "esnext",
|
|
2209
|
+
override: {}
|
|
2210
|
+
}
|
|
2211
2211
|
});
|
|
2212
2212
|
}
|
|
2213
2213
|
this.config.entry = getUniqueEntries(this.config.entry);
|
|
@@ -3617,6 +3617,43 @@ var DEFAULT_ESBUILD_CONFIG = {
|
|
|
3617
3617
|
logLevel: "silent"
|
|
3618
3618
|
};
|
|
3619
3619
|
function extractESBuildConfig(context) {
|
|
3620
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
3621
|
+
if (inject && Object.keys(inject).length > 0) {
|
|
3622
|
+
context.fs.writeFileSync(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
3623
|
+
if (value) {
|
|
3624
|
+
if (Array.isArray(value)) {
|
|
3625
|
+
if (camelCase.camelCase(key) !== key) {
|
|
3626
|
+
if (value.length === 1) {
|
|
3627
|
+
return `
|
|
3628
|
+
import ${camelCase.camelCase(key)} from "${value[0]}";
|
|
3629
|
+
export { ${camelCase.camelCase(key)} as "${key}" }`;
|
|
3630
|
+
} else if (value.length > 1) {
|
|
3631
|
+
return `
|
|
3632
|
+
import ${value[1] === "*" ? `* as ${camelCase.camelCase(key)}` : `{ ${value[1]} as ${camelCase.camelCase(key)} }`} from "${value[0]}";
|
|
3633
|
+
export { ${camelCase.camelCase(key)} as "${key}" }`;
|
|
3634
|
+
}
|
|
3635
|
+
} else if (value.length === 1) {
|
|
3636
|
+
return `
|
|
3637
|
+
import ${key} from "${value[0]}";
|
|
3638
|
+
export { ${key} };`;
|
|
3639
|
+
} else if (value.length > 1) {
|
|
3640
|
+
return `
|
|
3641
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
3642
|
+
export { ${key} };`;
|
|
3643
|
+
}
|
|
3644
|
+
} else if (camelCase.camelCase(key) !== key) {
|
|
3645
|
+
return `
|
|
3646
|
+
import ${camelCase.camelCase(key)} from "${value[0]}";
|
|
3647
|
+
export { ${camelCase.camelCase(key)} as "${key}" }`;
|
|
3648
|
+
} else {
|
|
3649
|
+
return `
|
|
3650
|
+
import ${key} from "${value}";
|
|
3651
|
+
export { ${key} };`;
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
return "";
|
|
3655
|
+
}).join("\n"));
|
|
3656
|
+
}
|
|
3620
3657
|
return defu3__default.default({
|
|
3621
3658
|
alias: context.builtins.reduce((ret, id) => {
|
|
3622
3659
|
const path = context.fs.ids[id];
|
|
@@ -3624,15 +3661,37 @@ function extractESBuildConfig(context) {
|
|
|
3624
3661
|
ret[id] = path;
|
|
3625
3662
|
}
|
|
3626
3663
|
return ret;
|
|
3627
|
-
}, {})
|
|
3628
|
-
|
|
3664
|
+
}, context.config.build.override.alias ?? context.config.build.alias ?? {}),
|
|
3665
|
+
inject: inject && Object.keys(inject).length > 0 ? [
|
|
3666
|
+
joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")
|
|
3667
|
+
] : void 0
|
|
3668
|
+
}, context.config.build.variant === "esbuild" ? omit.omit(context.config.build.override, [
|
|
3669
|
+
"alias",
|
|
3670
|
+
"inject",
|
|
3671
|
+
"external",
|
|
3672
|
+
"noExternal",
|
|
3673
|
+
"skipNodeModulesBundle",
|
|
3674
|
+
"extensions"
|
|
3675
|
+
]) : {}, {
|
|
3676
|
+
mainFields: context.config.build.mainFields,
|
|
3677
|
+
conditions: context.config.build.conditions,
|
|
3678
|
+
define: context.config.build.define,
|
|
3679
|
+
resolveExtensions: context.config.build.extensions,
|
|
3680
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
3629
3681
|
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
3630
3682
|
platform: context.config.build.platform,
|
|
3631
3683
|
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
3632
3684
|
outdir: context.config.output.outputPath,
|
|
3633
3685
|
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
3634
3686
|
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
3635
|
-
}, context.config.build.variant === "esbuild" ? context.config.build
|
|
3687
|
+
}, context.config.build.variant === "esbuild" ? omit.omit(context.config.build, [
|
|
3688
|
+
"alias",
|
|
3689
|
+
"inject",
|
|
3690
|
+
"external",
|
|
3691
|
+
"noExternal",
|
|
3692
|
+
"skipNodeModulesBundle",
|
|
3693
|
+
"extensions"
|
|
3694
|
+
]) : {}, {
|
|
3636
3695
|
minify: context.config.mode !== "development",
|
|
3637
3696
|
metafile: context.config.mode === "development",
|
|
3638
3697
|
sourcemap: context.config.mode === "development"
|
|
@@ -3668,13 +3727,14 @@ function extractViteConfig(context) {
|
|
|
3668
3727
|
ret[id] = path;
|
|
3669
3728
|
}
|
|
3670
3729
|
return ret;
|
|
3671
|
-
}, {})
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
}, {
|
|
3730
|
+
}, {}),
|
|
3731
|
+
dedupe: context.config.build.dedupe,
|
|
3732
|
+
mainFields: context.config.build.mainFields,
|
|
3733
|
+
conditions: context.config.build.conditions,
|
|
3734
|
+
extensions: context.config.build.extensions
|
|
3735
|
+
}
|
|
3736
|
+
}, context.config.build.variant === "vite" ? context.config.build.override : {}, {
|
|
3737
|
+
define: context.config.build.define,
|
|
3678
3738
|
rootDir: context.config.sourceRoot,
|
|
3679
3739
|
platform: context.config.build.platform,
|
|
3680
3740
|
mode: context.config.mode === "development" ? "development" : "production",
|
|
@@ -3686,8 +3746,7 @@ function extractViteConfig(context) {
|
|
|
3686
3746
|
},
|
|
3687
3747
|
esbuild: extractESBuildConfig(context),
|
|
3688
3748
|
logLevel: context.config.logLevel ?? void 0,
|
|
3689
|
-
envDir: context.config.projectRoot
|
|
3690
|
-
noExternal: context.builtins
|
|
3749
|
+
envDir: context.config.projectRoot
|
|
3691
3750
|
}, context.config.build.variant === "vite" ? context.config.build : {}, {
|
|
3692
3751
|
build: {
|
|
3693
3752
|
minify: context.config.mode !== "development",
|
|
@@ -3914,7 +3973,12 @@ var vite = unplugin.createVitePlugin(createUnpluginFactory("vite", (api, plugin)
|
|
|
3914
3973
|
api.context.config.mode = environmentChecks.isDevelopmentMode(env.mode) ? "development" : environmentChecks.isTestMode(env.mode) ? "test" : "production";
|
|
3915
3974
|
const environment = await api.context.getEnvironment();
|
|
3916
3975
|
const result = await api.callHook(environment, "config");
|
|
3917
|
-
return defu3__default.default(
|
|
3976
|
+
return defu3__default.default(
|
|
3977
|
+
extractViteConfig(api.context),
|
|
3978
|
+
// Need to use `any` here to avoid excessive type complexity
|
|
3979
|
+
result?.build ?? {},
|
|
3980
|
+
config
|
|
3981
|
+
);
|
|
3918
3982
|
},
|
|
3919
3983
|
async configResolved(_config) {
|
|
3920
3984
|
const environment = await api.context.getEnvironment();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMCZLD3NY_js = require('./chunk-MCZLD3NY.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
|
|
6
6
|
// src/executors/lint/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 = chunkMCZLD3NY_js.withExecutor("lint", executorFn);
|
|
15
15
|
var executor_default = executor;
|
|
16
16
|
|
|
17
17
|
exports.executorFn = executorFn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMCZLD3NY_js = require('./chunk-MCZLD3NY.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
var defu = require('defu');
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ async function executorFn(context, api) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
chunkSHUYVCID_js.__name(executorFn, "executorFn");
|
|
22
|
-
var executor =
|
|
22
|
+
var executor = chunkMCZLD3NY_js.withExecutor("build", executorFn);
|
|
23
23
|
var executor_default = executor;
|
|
24
24
|
|
|
25
25
|
exports.executorFn = executorFn;
|
|
@@ -10,6 +10,7 @@ import { readJsonFileSync } from '@stryke/fs/json';
|
|
|
10
10
|
import { murmurhash } from '@stryke/hash/murmurhash';
|
|
11
11
|
import { joinPaths } from '@stryke/path/join-paths';
|
|
12
12
|
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
13
|
+
import { titleCase } from '@stryke/string-format/title-case';
|
|
13
14
|
import { isError } from '@stryke/type-checks/is-error';
|
|
14
15
|
import defu from 'defu';
|
|
15
16
|
import { createJiti } from 'jiti';
|
|
@@ -56,10 +57,11 @@ function getNxPluginInputs(framework) {
|
|
|
56
57
|
__name(getNxPluginInputs, "getNxPluginInputs");
|
|
57
58
|
function createNxPlugin(opts) {
|
|
58
59
|
const framework = opts?.framework || "powerlines";
|
|
59
|
-
const
|
|
60
|
+
const name = opts?.name || `${framework}/plugin/nx`;
|
|
60
61
|
const artifactsFolder = opts?.artifactsFolder || `{projectRoot}/.${framework}`;
|
|
61
62
|
const targetInputs = getNxTargetInputs(framework);
|
|
62
63
|
const pluginInputs = getNxPluginInputs(framework);
|
|
64
|
+
console.debug(`[${name}]: Initializing the ${titleCase(framework)} Nx plugin for the following inputs: ${pluginInputs}`);
|
|
63
65
|
return [
|
|
64
66
|
pluginInputs,
|
|
65
67
|
async (configFiles, options, contextV2) => {
|
|
@@ -76,7 +78,7 @@ function createNxPlugin(opts) {
|
|
|
76
78
|
try {
|
|
77
79
|
const projectRoot = getProjectRoot(configFile, contextV2.workspaceRoot);
|
|
78
80
|
if (!projectRoot) {
|
|
79
|
-
console.error(`[${
|
|
81
|
+
console.error(`[${name}]: package.json and ${framework} configuration files (i.e. ${framework}.config.ts) must be located in the project root directory: ${configFile}`);
|
|
80
82
|
return {};
|
|
81
83
|
}
|
|
82
84
|
const root = getRoot(projectRoot, context);
|
|
@@ -91,12 +93,12 @@ function createNxPlugin(opts) {
|
|
|
91
93
|
const userConfig = await loadUserConfigFile(projectRoot, jiti, "build", "development", configFile, framework);
|
|
92
94
|
const packageJson = readJsonFileSync(joinPaths(projectRoot, "package.json"));
|
|
93
95
|
if (!userConfig.configFile && !packageJson.storm) {
|
|
94
|
-
console.debug(`[${
|
|
96
|
+
console.debug(`[${name}]: Skipping ${projectRoot} - no ${framework} configuration found for project in root directory.`);
|
|
95
97
|
return {};
|
|
96
98
|
}
|
|
97
99
|
const projectConfig = getProjectConfigFromProjectRoot(projectRoot, packageJson);
|
|
98
100
|
if (!projectConfig) {
|
|
99
|
-
console.warn(`[${
|
|
101
|
+
console.warn(`[${name}]: No project configuration found for project in root directory ${projectRoot}`);
|
|
100
102
|
return {};
|
|
101
103
|
}
|
|
102
104
|
const tsconfig = userConfig?.tsconfig || (existsSync(joinPaths(projectRoot, "tsconfig.json")) ? joinPaths(projectRoot, "tsconfig.json") : void 0);
|
|
@@ -285,7 +287,7 @@ function createNxPlugin(opts) {
|
|
|
285
287
|
}
|
|
286
288
|
};
|
|
287
289
|
}
|
|
288
|
-
setDefaultProjectTags(projectConfig,
|
|
290
|
+
setDefaultProjectTags(projectConfig, name);
|
|
289
291
|
addProjectTag(projectConfig, framework, projectConfig.projectType || userConfig.type || "library", {
|
|
290
292
|
overwrite: true
|
|
291
293
|
});
|
|
@@ -301,7 +303,7 @@ function createNxPlugin(opts) {
|
|
|
301
303
|
}
|
|
302
304
|
};
|
|
303
305
|
} catch (error) {
|
|
304
|
-
console.error(`[${
|
|
306
|
+
console.error(`[${name}]: ${isError(error) ? error.message : "Unknown fatal error"}`);
|
|
305
307
|
return {};
|
|
306
308
|
}
|
|
307
309
|
}, configFiles, options, contextV2);
|
|
@@ -311,10 +313,8 @@ function createNxPlugin(opts) {
|
|
|
311
313
|
__name(createNxPlugin, "createNxPlugin");
|
|
312
314
|
|
|
313
315
|
// src/plugin/index.ts
|
|
314
|
-
var name = "powerlines/nx/plugin";
|
|
315
316
|
var createNodesV2 = createNxPlugin({
|
|
316
|
-
name,
|
|
317
317
|
framework: "powerlines"
|
|
318
318
|
});
|
|
319
319
|
|
|
320
|
-
export { createNodesV2
|
|
320
|
+
export { createNodesV2 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMCZLD3NY_js = require('./chunk-MCZLD3NY.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
var defu = require('defu');
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ async function executorFn(context, api) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
chunkSHUYVCID_js.__name(executorFn, "executorFn");
|
|
22
|
-
var executor =
|
|
22
|
+
var executor = chunkMCZLD3NY_js.withExecutor("prepare", executorFn);
|
|
23
23
|
var executor_default = executor;
|
|
24
24
|
|
|
25
25
|
exports.executorFn = executorFn;
|