@powerlines/nx 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/{chunk-2IKNOV7W.mjs → chunk-22QO45EK.mjs} +31 -50
- package/dist/{chunk-OZMYXUES.mjs → chunk-4T5LIOS7.mjs} +39 -172
- package/dist/{chunk-WKH7IEJU.js → chunk-6SBXXTFC.js} +2 -2
- package/dist/{chunk-AKX3TTDA.js → chunk-BM7JS6C2.js} +2 -2
- package/dist/{chunk-ESI25Y6Y.mjs → chunk-EJ5N22VV.mjs} +1 -1
- package/dist/{chunk-CQP2LCFV.mjs → chunk-GZAHD3HX.mjs} +1 -1
- package/dist/{chunk-5K7DMFAV.mjs → chunk-HCFUFMAF.mjs} +1 -1
- package/dist/{chunk-6UG6SXHV.js → chunk-MQKPEN3X.js} +39 -172
- package/dist/{chunk-6ZABD5GY.js → chunk-MQQZWVFL.js} +2 -2
- package/dist/{chunk-3QPPK4K2.js → chunk-VFYKWLFU.js} +2 -2
- package/dist/{chunk-FXCIWWXO.mjs → chunk-WAQHDLQP.mjs} +1 -1
- package/dist/{chunk-E6VIOC6R.mjs → chunk-XSNPOHTI.mjs} +1 -1
- package/dist/{chunk-O6BSKBJP.js → chunk-Y7LKUYQR.js} +2 -2
- package/dist/{chunk-OOERKIVS.js → chunk-Z4BJ37JY.js} +31 -50
- package/dist/executors.js +11 -11
- package/dist/executors.mjs +6 -6
- package/dist/index.js +14 -14
- 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 +9 -0
- package/dist/src/plugin/index.d.ts +9 -0
- package/dist/src/plugin/index.js +3 -3
- package/dist/src/plugin/index.mjs +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Changelog for Powerlines - Nx
|
|
4
|
+
|
|
5
|
+
## [0.2.0](https://github.com/storm-software/powerlines/releases/tag/nx%400.2.0) (2025-10-21)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **nx:** Added `runtimeFolder` configuration option to plugin
|
|
10
|
+
([ddfa6fc](https://github.com/storm-software/powerlines/commit/ddfa6fc))
|
|
11
|
+
|
|
12
|
+
### Updated Dependencies
|
|
13
|
+
|
|
14
|
+
- Updated powerlines to 0.2.0
|
|
15
|
+
|
|
16
|
+
## [0.1.0](https://github.com/storm-software/powerlines/releases/tag/nx%400.1.0) (2025-10-20)
|
|
17
|
+
|
|
18
|
+
### Updated Dependencies
|
|
19
|
+
|
|
20
|
+
- Updated powerlines to 0.1.0
|
|
@@ -12,44 +12,42 @@ import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
|
12
12
|
import { isError } from '@stryke/type-checks/is-error';
|
|
13
13
|
import defu from 'defu';
|
|
14
14
|
import { createJiti } from 'jiti';
|
|
15
|
-
import { join } from 'node:path';
|
|
16
15
|
import { readNxJson } from 'nx/src/config/nx-json.js';
|
|
17
16
|
import { readTargetsFromPackageJson } from 'nx/src/utils/package-json.js';
|
|
18
17
|
|
|
19
18
|
// src/helpers/constants.ts
|
|
20
19
|
var CONFIG_INPUTS = [
|
|
21
|
-
"{projectRoot}
|
|
22
|
-
"{projectRoot}/
|
|
23
|
-
"{projectRoot}/
|
|
24
|
-
"{projectRoot}/
|
|
25
|
-
"{projectRoot}/
|
|
26
|
-
"{projectRoot}/
|
|
27
|
-
"{projectRoot}/
|
|
28
|
-
"{projectRoot}/
|
|
29
|
-
"{projectRoot}/
|
|
30
|
-
"{projectRoot}/
|
|
31
|
-
"{projectRoot}/
|
|
32
|
-
"{projectRoot}/
|
|
33
|
-
"{projectRoot}/
|
|
34
|
-
"{projectRoot}/
|
|
35
|
-
"{projectRoot}/
|
|
36
|
-
"{projectRoot}/
|
|
37
|
-
"{projectRoot}/
|
|
38
|
-
"{projectRoot}/
|
|
39
|
-
"{projectRoot}/
|
|
40
|
-
"{projectRoot}/
|
|
41
|
-
"{projectRoot}/
|
|
42
|
-
"{projectRoot}/
|
|
43
|
-
"{projectRoot}/
|
|
44
|
-
"{projectRoot}/
|
|
45
|
-
"{projectRoot}/
|
|
20
|
+
"{projectRoot}/package.json",
|
|
21
|
+
"{projectRoot}/powerlines.json",
|
|
22
|
+
"{projectRoot}/powerlines.*.json",
|
|
23
|
+
"{projectRoot}/powerlines.jsonc",
|
|
24
|
+
"{projectRoot}/powerlines.*.jsonc",
|
|
25
|
+
"{projectRoot}/powerlines.json5",
|
|
26
|
+
"{projectRoot}/powerlines.*.json5",
|
|
27
|
+
"{projectRoot}/powerlines.yaml",
|
|
28
|
+
"{projectRoot}/powerlines.*.yaml",
|
|
29
|
+
"{projectRoot}/powerlines.yml",
|
|
30
|
+
"{projectRoot}/powerlines.*.yml",
|
|
31
|
+
"{projectRoot}/powerlines.toml",
|
|
32
|
+
"{projectRoot}/powerlines.*.toml",
|
|
33
|
+
"{projectRoot}/powerlines.js",
|
|
34
|
+
"{projectRoot}/powerlines.*.js",
|
|
35
|
+
"{projectRoot}/powerlines.cjs",
|
|
36
|
+
"{projectRoot}/powerlines.*.cjs",
|
|
37
|
+
"{projectRoot}/powerlines.mjs",
|
|
38
|
+
"{projectRoot}/powerlines.*.mjs",
|
|
39
|
+
"{projectRoot}/powerlines.ts",
|
|
40
|
+
"{projectRoot}/powerlines.*.ts",
|
|
41
|
+
"{projectRoot}/powerlines.cts",
|
|
42
|
+
"{projectRoot}/powerlines.*.cts",
|
|
43
|
+
"{projectRoot}/powerlines.mts",
|
|
44
|
+
"{projectRoot}/powerlines.*.mts"
|
|
46
45
|
];
|
|
47
46
|
|
|
48
47
|
// src/plugin/index.ts
|
|
49
48
|
var name = "powerlines/nx/plugin";
|
|
50
|
-
var stormConfigGlob = "**/{package.json,storm.json,storm.*.json,storm.jsonc,storm.*.jsonc,storm.json5,storm.*.json5,storm.yaml,storm.*.yaml,storm.yml,storm.*.yml,storm.toml,storm.*.toml,storm.js,storm.*.js,storm.ts,storm.*.ts,storm.mjs,storm.*.mjs,storm.cjs,storm.*.cjs,storm.mts,storm.*.mts,storm.cts,storm.*.cts}";
|
|
51
49
|
var createNodesV2 = [
|
|
52
|
-
|
|
50
|
+
`**/{${CONFIG_INPUTS.map((input) => input.replace("{projectRoot}/", "")).join(",")}}`,
|
|
53
51
|
async (configFiles, optionsV2, contextV2) => {
|
|
54
52
|
const envPaths = getEnvPaths({
|
|
55
53
|
orgId: "storm-software",
|
|
@@ -59,6 +57,7 @@ var createNodesV2 = [
|
|
|
59
57
|
if (!envPaths.cache) {
|
|
60
58
|
throw new Error("The cache directory could not be determined.");
|
|
61
59
|
}
|
|
60
|
+
const runtimeFolder = optionsV2?.runtimeFolder || ".powerlines";
|
|
62
61
|
const nxJson = readNxJson(contextV2.workspaceRoot);
|
|
63
62
|
return createNodesFromFiles(async (configFile, options, context) => {
|
|
64
63
|
try {
|
|
@@ -119,7 +118,7 @@ var createNodesV2 = [
|
|
|
119
118
|
"typescript"
|
|
120
119
|
]),
|
|
121
120
|
outputs: [
|
|
122
|
-
|
|
121
|
+
`{projectRoot}/${runtimeFolder}`
|
|
123
122
|
],
|
|
124
123
|
dependsOn: [
|
|
125
124
|
"clean",
|
|
@@ -147,24 +146,6 @@ var createNodesV2 = [
|
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
|
-
targets["type-check"] ??= {
|
|
151
|
-
cache: true,
|
|
152
|
-
inputs: [
|
|
153
|
-
"typescript",
|
|
154
|
-
"^production"
|
|
155
|
-
],
|
|
156
|
-
outputs: [
|
|
157
|
-
"{workspaceRoot}/dist/{projectRoot}"
|
|
158
|
-
],
|
|
159
|
-
executor: "nx:run-commands",
|
|
160
|
-
dependsOn: [
|
|
161
|
-
"^type-check",
|
|
162
|
-
"^build"
|
|
163
|
-
],
|
|
164
|
-
options: {
|
|
165
|
-
command: `pnpm exec tsc --noEmit --pretty --project ${userConfig.tsconfig || join(projectConfig.root, "tsconfig.json")}`
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
149
|
targets.build = {
|
|
169
150
|
cache: true,
|
|
170
151
|
inputs: withNamedInputs(CONFIG_INPUTS, [
|
|
@@ -204,13 +185,13 @@ var createNodesV2 = [
|
|
|
204
185
|
cache: true,
|
|
205
186
|
inputs: withNamedInputs([
|
|
206
187
|
...CONFIG_INPUTS,
|
|
207
|
-
|
|
188
|
+
`{projectRoot}/${runtimeFolder}`
|
|
208
189
|
], [
|
|
209
190
|
"linting",
|
|
210
191
|
"typescript"
|
|
211
192
|
]),
|
|
212
193
|
outputs: withNamedInputs([
|
|
213
|
-
|
|
194
|
+
`{projectRoot}/${runtimeFolder}`
|
|
214
195
|
], [
|
|
215
196
|
"typescript"
|
|
216
197
|
]),
|
|
@@ -244,7 +225,7 @@ var createNodesV2 = [
|
|
|
244
225
|
cache: true,
|
|
245
226
|
inputs: withNamedInputs([
|
|
246
227
|
...CONFIG_INPUTS,
|
|
247
|
-
|
|
228
|
+
`{projectRoot}/${runtimeFolder}`
|
|
248
229
|
], [
|
|
249
230
|
"documentation",
|
|
250
231
|
"typescript"
|
|
@@ -9,7 +9,7 @@ import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
|
9
9
|
import { toArray } from '@stryke/convert/to-array';
|
|
10
10
|
import { copyFiles } from '@stryke/fs/copy-file';
|
|
11
11
|
import { existsSync } from '@stryke/fs/exists';
|
|
12
|
-
import { createDirectory
|
|
12
|
+
import { createDirectory } from '@stryke/fs/helpers';
|
|
13
13
|
import { install } from '@stryke/fs/install';
|
|
14
14
|
import { listFiles, listFilesSync } from '@stryke/fs/list-files';
|
|
15
15
|
import { isPackageExists, isPackageListed, doesPackageMatch, getPackageListing } from '@stryke/fs/package-fns';
|
|
@@ -24,17 +24,14 @@ import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
|
24
24
|
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
25
25
|
import chalk5 from 'chalk';
|
|
26
26
|
import Handlebars from 'handlebars';
|
|
27
|
-
import { writeFile as writeFile$1 } from 'node:fs/promises';
|
|
28
|
-
import path, { sep } from 'node:path';
|
|
29
|
-
import { Application, TypeDocReader, PackageJsonReader, TSConfigReader, Converter, ReflectionKind, PageEvent } from 'typedoc';
|
|
30
27
|
import { readJsonFile, readJsonFileSync } from '@stryke/fs/json';
|
|
31
28
|
import { appendPath } from '@stryke/path/append';
|
|
32
29
|
import ts3, { createProgram, createCompilerHost, getPreEmitDiagnostics, getLineAndCharacterOfPosition, flattenDiagnosticMessageText } from 'typescript';
|
|
30
|
+
import { titleCase } from '@stryke/string-format/title-case';
|
|
33
31
|
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
34
|
-
import { writeFile } from '@stryke/fs/write-file';
|
|
32
|
+
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
35
33
|
import { format, resolveConfig } from 'prettier';
|
|
36
34
|
import { resolvePackage } from '@stryke/fs/resolve';
|
|
37
|
-
import { titleCase } from '@stryke/string-format/title-case';
|
|
38
35
|
import { getEnvPaths } from '@stryke/env/get-env-paths';
|
|
39
36
|
import { relativeToWorkspaceRoot, getWorkspaceRoot } from '@stryke/fs/get-workspace-root';
|
|
40
37
|
import { murmurhash } from '@stryke/hash/murmurhash';
|
|
@@ -61,6 +58,7 @@ import { isDirectory } from '@stryke/fs/is-file';
|
|
|
61
58
|
import { readFile, readFileIfExistingSync } from '@stryke/fs/read-file';
|
|
62
59
|
import { isValidRange, parseVersion } from '@stryke/fs/semver-fns';
|
|
63
60
|
import { getParentPath } from '@stryke/path/get-parent-path';
|
|
61
|
+
import path from 'node:path';
|
|
64
62
|
import { hasPackageVersion, getPackageName, getPackageVersion } from '@stryke/string-format/package';
|
|
65
63
|
import { transformAsync } from '@babel/core';
|
|
66
64
|
import MagicString from 'magic-string';
|
|
@@ -76,125 +74,6 @@ import { match, tsconfigPathsToRegExp } from 'bundle-require';
|
|
|
76
74
|
import { defineNuxtModule, addVitePlugin, addWebpackPlugin } from '@nuxt/kit';
|
|
77
75
|
import '@nuxt/schema';
|
|
78
76
|
|
|
79
|
-
var objectToFrontmatter = /* @__PURE__ */ __name((object = {}) => Object.entries(object).filter(([, value]) => {
|
|
80
|
-
return value !== void 0 && value !== null && value !== "" && typeof value === "string" || Array.isArray(value) && value.length > 0;
|
|
81
|
-
}).map(([key, value]) => `${key}: ${value}`).join("\n"), "objectToFrontmatter");
|
|
82
|
-
var onRendererPageEnd = /* @__PURE__ */ __name((frontmatterObject) => (event) => {
|
|
83
|
-
if (!event.contents) {
|
|
84
|
-
return;
|
|
85
|
-
} else if (/README\.md$/.test(event.url)) {
|
|
86
|
-
event.preventDefault();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const frontmatter = `---
|
|
90
|
-
title: '${event.model.name}'
|
|
91
|
-
${objectToFrontmatter(frontmatterObject)}
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
`;
|
|
95
|
-
event.contents = frontmatter + event.contents;
|
|
96
|
-
}, "onRendererPageEnd");
|
|
97
|
-
var buildNavigationFromProjectReflection = /* @__PURE__ */ __name((baseUrl = "", project) => {
|
|
98
|
-
const baseUrlWithoutTrailingSlash = baseUrl.replace(/\/$/gm, "");
|
|
99
|
-
const result = {
|
|
100
|
-
type: "flat"
|
|
101
|
-
};
|
|
102
|
-
const isGroupOfModules = /* @__PURE__ */ __name((group) => group.title === "Modules", "isGroupOfModules");
|
|
103
|
-
const reflectionToNavItem = /* @__PURE__ */ __name((reflection) => {
|
|
104
|
-
return {
|
|
105
|
-
title: reflection.name,
|
|
106
|
-
url: `${baseUrlWithoutTrailingSlash}/${reflection.url}`.replace(/\.md$/, "")
|
|
107
|
-
};
|
|
108
|
-
}, "reflectionToNavItem");
|
|
109
|
-
const modulesGroupToNavigationGroup = /* @__PURE__ */ __name((module) => ({
|
|
110
|
-
items: (module.groups ?? []).flatMap((group) => group.children.map(reflectionToNavItem)),
|
|
111
|
-
name: module.name
|
|
112
|
-
}), "modulesGroupToNavigationGroup");
|
|
113
|
-
const navFromReflectionGroups = /* @__PURE__ */ __name((groups, nav = {
|
|
114
|
-
type: "flat"
|
|
115
|
-
}) => {
|
|
116
|
-
groups.forEach((group) => {
|
|
117
|
-
if (isGroupOfModules(group)) {
|
|
118
|
-
nav.type = "modular";
|
|
119
|
-
nav.modules = group.children.map(modulesGroupToNavigationGroup);
|
|
120
|
-
} else {
|
|
121
|
-
nav.items = nav?.items?.length ? nav.items : [];
|
|
122
|
-
nav.items = nav.items.concat(group.children.flatMap(reflectionToNavItem));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return nav;
|
|
126
|
-
}, "navFromReflectionGroups");
|
|
127
|
-
return navFromReflectionGroups(project.groups, result);
|
|
128
|
-
}, "buildNavigationFromProjectReflection");
|
|
129
|
-
var onDeclaration = /* @__PURE__ */ __name((entryPoints = []) => (context, reflection) => {
|
|
130
|
-
if (reflection.kind === ReflectionKind.Module) {
|
|
131
|
-
const matchingEntryPoint = entryPoints.find((entryPoint) => entryPoint.path === reflection.sources[0].fullFileName);
|
|
132
|
-
reflection.name = matchingEntryPoint?.name ?? reflection.name;
|
|
133
|
-
}
|
|
134
|
-
}, "onDeclaration");
|
|
135
|
-
var typedocConfig = {
|
|
136
|
-
excludeExternals: true,
|
|
137
|
-
excludeInternal: true,
|
|
138
|
-
excludePrivate: true,
|
|
139
|
-
excludeProtected: true,
|
|
140
|
-
githubPages: false
|
|
141
|
-
};
|
|
142
|
-
var markdownPluginConfig = {
|
|
143
|
-
hideBreadcrumbs: true,
|
|
144
|
-
hideInPageTOC: true,
|
|
145
|
-
hidePageHeader: true,
|
|
146
|
-
hidePageTitle: true
|
|
147
|
-
};
|
|
148
|
-
var removeTrailingSlash = /* @__PURE__ */ __name((pathString = "") => pathString.endsWith(sep) ? pathString.slice(0, pathString.length - 1) : pathString, "removeTrailingSlash");
|
|
149
|
-
var initTypedoc = /* @__PURE__ */ __name(async (context, options) => {
|
|
150
|
-
const { baseUrl = "/docs/", outputPath } = options;
|
|
151
|
-
const entryPoints = options.entryPoints ?? context.entry.map((entry) => ({
|
|
152
|
-
name: entry.name || entry.output || findFileName(entry.file, {
|
|
153
|
-
withExtension: false
|
|
154
|
-
}),
|
|
155
|
-
path: joinPaths(context.config.projectRoot, entry.file)
|
|
156
|
-
}));
|
|
157
|
-
const app = await Application.bootstrapWithPlugins({
|
|
158
|
-
...typedocConfig,
|
|
159
|
-
...markdownPluginConfig,
|
|
160
|
-
gitRevision: context.workspaceConfig.branch || "main",
|
|
161
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
162
|
-
exclude: context.tsconfig.tsconfigJson.exclude?.filter(Boolean),
|
|
163
|
-
out: outputPath,
|
|
164
|
-
basePath: baseUrl,
|
|
165
|
-
entryPoints: entryPoints?.map((e) => e.path),
|
|
166
|
-
plugin: [
|
|
167
|
-
"typedoc-plugin-markdown",
|
|
168
|
-
"powerlines/lib/typedoc/plugin"
|
|
169
|
-
],
|
|
170
|
-
theme: "powerlines",
|
|
171
|
-
readme: "none",
|
|
172
|
-
excludePrivate: true,
|
|
173
|
-
hideGenerator: true
|
|
174
|
-
}, [
|
|
175
|
-
new TypeDocReader(),
|
|
176
|
-
new PackageJsonReader(),
|
|
177
|
-
new TSConfigReader()
|
|
178
|
-
]);
|
|
179
|
-
app.options.addReader(new TSConfigReader());
|
|
180
|
-
app.converter.on(Converter.EVENT_CREATE_DECLARATION, onDeclaration(entryPoints));
|
|
181
|
-
const getReflections = /* @__PURE__ */ __name(async () => app.convert(), "getReflections");
|
|
182
|
-
const generateDocs = /* @__PURE__ */ __name(async (opts) => {
|
|
183
|
-
const { outputPath: outputFolder, project, frontmatter } = opts;
|
|
184
|
-
app.renderer.on(PageEvent.END, onRendererPageEnd(frontmatter));
|
|
185
|
-
await app.generateDocs(project, outputFolder || outputPath);
|
|
186
|
-
}, "generateDocs");
|
|
187
|
-
const generateNavigationJSON = /* @__PURE__ */ __name(async (project, outputFolder = outputPath) => {
|
|
188
|
-
const navigation = buildNavigationFromProjectReflection(baseUrl, project);
|
|
189
|
-
await writeFile$1(`${removeTrailingSlash(outputFolder)}/nav.json`, JSON.stringify(navigation));
|
|
190
|
-
}, "generateNavigationJSON");
|
|
191
|
-
return {
|
|
192
|
-
app,
|
|
193
|
-
generateDocs,
|
|
194
|
-
generateNavigationJSON,
|
|
195
|
-
getReflections
|
|
196
|
-
};
|
|
197
|
-
}, "initTypedoc");
|
|
198
77
|
function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig = "tsconfig.json") {
|
|
199
78
|
let tsconfigFilePath = tsconfig;
|
|
200
79
|
if (!existsSync(tsconfigFilePath)) {
|
|
@@ -277,26 +156,22 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
277
156
|
};
|
|
278
157
|
}
|
|
279
158
|
__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
280
|
-
|
|
281
|
-
// ../powerlines/src/lib/utilities/file-header.ts
|
|
282
|
-
function getBaseFileHeader() {
|
|
159
|
+
function getBaseFileHeader(context) {
|
|
283
160
|
return `
|
|
284
|
-
// Generated with
|
|
161
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
285
162
|
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
286
163
|
`;
|
|
287
164
|
}
|
|
288
165
|
__name(getBaseFileHeader, "getBaseFileHeader");
|
|
289
|
-
function getFileHeader(
|
|
290
|
-
|
|
291
|
-
directive = directive.replaceAll("powerlines/runtime-types", "../../dist/packages/types");
|
|
292
|
-
}
|
|
166
|
+
function getFileHeader(context, options = {}) {
|
|
167
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
293
168
|
return `/* eslint-disable */
|
|
294
169
|
// biome-ignore lint: disable
|
|
295
170
|
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
|
|
296
171
|
|
|
297
172
|
${directive}
|
|
298
173
|
` : "\n"}
|
|
299
|
-
${getBaseFileHeader()}
|
|
174
|
+
${getBaseFileHeader(context)}
|
|
300
175
|
|
|
301
176
|
`;
|
|
302
177
|
}
|
|
@@ -369,24 +244,24 @@ function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
|
369
244
|
}
|
|
370
245
|
}
|
|
371
246
|
__name(addPluginHook, "addPluginHook");
|
|
372
|
-
async function
|
|
247
|
+
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
373
248
|
try {
|
|
374
249
|
if (skipFormat) {
|
|
375
|
-
await writeFile(filepath, content);
|
|
250
|
+
await writeFile$1(filepath, content);
|
|
376
251
|
} else {
|
|
377
252
|
const config = await resolveConfig(filepath);
|
|
378
253
|
const formatted = await format(content, {
|
|
379
254
|
...config ?? {},
|
|
380
255
|
filepath
|
|
381
256
|
});
|
|
382
|
-
await writeFile(filepath, formatted || "");
|
|
257
|
+
await writeFile$1(filepath, formatted || "");
|
|
383
258
|
}
|
|
384
259
|
} catch (error) {
|
|
385
260
|
log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
|
|
386
261
|
${error?.message ? error.message : ""}`);
|
|
387
262
|
}
|
|
388
263
|
}
|
|
389
|
-
__name(
|
|
264
|
+
__name(writeFile, "writeFile");
|
|
390
265
|
var DEFAULT_ENVIRONMENT = "default";
|
|
391
266
|
function createEnvironment(name, userConfig) {
|
|
392
267
|
return defu4(userConfig.environments?.[name] ?? {}, {
|
|
@@ -727,7 +602,7 @@ var VirtualFileSystem = class {
|
|
|
727
602
|
* @returns Whether the ID is a valid runtime ID.
|
|
728
603
|
*/
|
|
729
604
|
isValidBuiltinId(id) {
|
|
730
|
-
return id.startsWith(`${this.#context.config.builtinPrefix}:`);
|
|
605
|
+
return id.startsWith(`${this.#context.config.output.builtinPrefix}:`);
|
|
731
606
|
}
|
|
732
607
|
/**
|
|
733
608
|
* Check if a path or ID corresponds to a virtual file.
|
|
@@ -1307,7 +1182,7 @@ var VirtualFileSystem = class {
|
|
|
1307
1182
|
if (!isSetString(path2)) {
|
|
1308
1183
|
throw new Error(`Invalid path provided. Expected a string or a valid file path.`);
|
|
1309
1184
|
}
|
|
1310
|
-
return path2.replace(new RegExp(`^${this.#context.config.builtinPrefix}:`), "").replace(/^\\0/, "");
|
|
1185
|
+
return path2.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "");
|
|
1311
1186
|
}
|
|
1312
1187
|
/**
|
|
1313
1188
|
* Converts a relative path to an absolute path based on the workspace and project root.
|
|
@@ -1331,7 +1206,7 @@ var VirtualFileSystem = class {
|
|
|
1331
1206
|
* @returns The formatted runtime ID.
|
|
1332
1207
|
*/
|
|
1333
1208
|
formatRuntimeId(id) {
|
|
1334
|
-
return `${this.#context.config.builtinPrefix}:${this.formatFilePath(id).replace(/\.[m|c]?[t|j]sx?$/, "")}`;
|
|
1209
|
+
return `${this.#context.config.output.builtinPrefix}:${this.formatFilePath(id).replace(/\.[m|c]?[t|j]sx?$/, "")}`;
|
|
1335
1210
|
}
|
|
1336
1211
|
/**
|
|
1337
1212
|
* Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
@@ -1340,7 +1215,7 @@ var VirtualFileSystem = class {
|
|
|
1340
1215
|
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1341
1216
|
*/
|
|
1342
1217
|
resolvePathName(pathOrId, options = {}) {
|
|
1343
|
-
if (pathOrId.startsWith(`${this.#context.config.builtinPrefix}:`)) {
|
|
1218
|
+
if (pathOrId.startsWith(`${this.#context.config.output.builtinPrefix}:`)) {
|
|
1344
1219
|
return false;
|
|
1345
1220
|
}
|
|
1346
1221
|
if (isAbsolutePath(pathOrId)) {
|
|
@@ -1658,7 +1533,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1658
1533
|
configFile: config.configFile,
|
|
1659
1534
|
customLogger: config.customLogger,
|
|
1660
1535
|
logLevel: config.logLevel,
|
|
1661
|
-
builtinPrefix: config.builtinPrefix,
|
|
1662
1536
|
tsconfig: config.tsconfig,
|
|
1663
1537
|
tsconfigRaw: config.tsconfigRaw,
|
|
1664
1538
|
skipCache: config.skipCache,
|
|
@@ -1670,7 +1544,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1670
1544
|
lint: config.lint,
|
|
1671
1545
|
transform: config.transform,
|
|
1672
1546
|
build: config.build,
|
|
1673
|
-
override: config.override
|
|
1547
|
+
override: config.override,
|
|
1548
|
+
framework: config.framework
|
|
1674
1549
|
};
|
|
1675
1550
|
}
|
|
1676
1551
|
/**
|
|
@@ -1966,7 +1841,9 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1966
1841
|
output: {
|
|
1967
1842
|
outputPath: joinPaths$1("dist", cacheKey.projectRoot),
|
|
1968
1843
|
mode: "virtual",
|
|
1969
|
-
dts: joinPaths$1(cacheKey.projectRoot, "
|
|
1844
|
+
dts: joinPaths$1(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
|
|
1845
|
+
builtinPrefix: config.framework ?? "powerlines",
|
|
1846
|
+
runtimeFolder: joinPaths$1(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
|
|
1970
1847
|
assets: [
|
|
1971
1848
|
{
|
|
1972
1849
|
glob: "LICENSE"
|
|
@@ -1984,11 +1861,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1984
1861
|
}, options.isHighPriority ? {} : this.#getConfigProps(config), {
|
|
1985
1862
|
inlineConfig: {},
|
|
1986
1863
|
userConfig: {},
|
|
1864
|
+
framework: "powerlines",
|
|
1987
1865
|
platform: "neutral",
|
|
1988
1866
|
mode: "production",
|
|
1989
1867
|
projectType: "application",
|
|
1990
1868
|
logLevel: "info",
|
|
1991
|
-
builtinPrefix: "storm",
|
|
1992
1869
|
preview: false,
|
|
1993
1870
|
environments: {},
|
|
1994
1871
|
transform: {
|
|
@@ -2510,7 +2387,7 @@ export default getConfig({
|
|
|
2510
2387
|
});
|
|
2511
2388
|
`;
|
|
2512
2389
|
log(LogLevelLabel.INFO, `Writing a default ESLint config file to ${eslintConfigFile}`);
|
|
2513
|
-
return
|
|
2390
|
+
return writeFile(log, eslintConfigFile, eslintConfig);
|
|
2514
2391
|
}
|
|
2515
2392
|
__name(writeDefaultEslintConfig, "writeDefaultEslintConfig");
|
|
2516
2393
|
var VALID_SEVERITY = [
|
|
@@ -2528,7 +2405,7 @@ async function writeOutputFile(log, outputFile, outputData) {
|
|
|
2528
2405
|
log(LogLevelLabel.ERROR, `Cannot write to output file path, it is a directory: ${filePath}`);
|
|
2529
2406
|
} else {
|
|
2530
2407
|
try {
|
|
2531
|
-
await
|
|
2408
|
+
await writeFile(log, filePath, outputData);
|
|
2532
2409
|
log(LogLevelLabel.INFO, `The output file has been created: ${filePath}`);
|
|
2533
2410
|
} catch (err) {
|
|
2534
2411
|
log(LogLevelLabel.ERROR, `There was a problem writing the output file: ${filePath}`);
|
|
@@ -3002,7 +2879,10 @@ ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : dia
|
|
|
3002
2879
|
const sourceFile = getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
|
|
3003
2880
|
/// <reference types="powerlines/${context.config.build.platform}" />` : ""}
|
|
3004
2881
|
|
|
3005
|
-
${getFileHeader(
|
|
2882
|
+
${getFileHeader(context, {
|
|
2883
|
+
directive: null,
|
|
2884
|
+
prettierIgnore: false
|
|
2885
|
+
})}
|
|
3006
2886
|
|
|
3007
2887
|
${builtinModules}`.replace(
|
|
3008
2888
|
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
@@ -3194,7 +3074,7 @@ async function resolveTsconfig(context) {
|
|
|
3194
3074
|
`).join("\n")}
|
|
3195
3075
|
`);
|
|
3196
3076
|
}
|
|
3197
|
-
await
|
|
3077
|
+
await writeFile(context.log, context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
|
|
3198
3078
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
3199
3079
|
if (!context.tsconfig) {
|
|
3200
3080
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
@@ -3403,7 +3283,7 @@ ${formatLogMessage(context.config)}`);
|
|
|
3403
3283
|
if (context.config.projectType === "application") {
|
|
3404
3284
|
context.log(LogLevelLabel.TRACE, "Generating built-in barrel file");
|
|
3405
3285
|
await context.fs.writeBuiltinFile("index", joinPaths(context.builtinsPath, "index.ts"), `
|
|
3406
|
-
${getFileHeader()}
|
|
3286
|
+
${getFileHeader(context)}
|
|
3407
3287
|
|
|
3408
3288
|
${(await context.fs.listBuiltinFiles()).filter((file) => !isParentPath(file.path, joinPaths(context.builtinsPath, "log")) && !isParentPath(file.path, joinPaths(context.builtinsPath, "storage"))).map((file) => `export * from "./${replacePath(file.path, context.builtinsPath).replace(`.${findFileExtensionSafe(file.path)}`, "")}";`).join("\n")}
|
|
3409
3289
|
`);
|
|
@@ -3441,7 +3321,7 @@ ${formatLogMessage(context.config)}`);
|
|
|
3441
3321
|
for (const file of files) {
|
|
3442
3322
|
context.log(LogLevelLabel.TRACE, `Adding template file: ${file}`);
|
|
3443
3323
|
const template = Handlebars.compile(file);
|
|
3444
|
-
await
|
|
3324
|
+
await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3445
3325
|
}
|
|
3446
3326
|
await this.callNormalHook(context, "new");
|
|
3447
3327
|
if (context.config.projectType === "application") {
|
|
@@ -3449,14 +3329,14 @@ ${formatLogMessage(context.config)}`);
|
|
|
3449
3329
|
for (const file of files2) {
|
|
3450
3330
|
context.log(LogLevelLabel.TRACE, `Adding application template file: ${file}`);
|
|
3451
3331
|
const template = Handlebars.compile(file);
|
|
3452
|
-
await
|
|
3332
|
+
await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3453
3333
|
}
|
|
3454
3334
|
} else {
|
|
3455
3335
|
const files2 = await listFiles(joinPaths(context.corePackagePath, "files/library/**/*.hbs"));
|
|
3456
3336
|
for (const file of files2) {
|
|
3457
3337
|
context.log(LogLevelLabel.TRACE, `Adding library template file: ${file}`);
|
|
3458
3338
|
const template = Handlebars.compile(file);
|
|
3459
|
-
await
|
|
3339
|
+
await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3460
3340
|
}
|
|
3461
3341
|
}
|
|
3462
3342
|
await this.callPostHook(context, "new");
|
|
@@ -3540,27 +3420,14 @@ ${formatLogMessage(context.config)}`);
|
|
|
3540
3420
|
async docs(inlineConfig = {
|
|
3541
3421
|
command: "docs"
|
|
3542
3422
|
}) {
|
|
3543
|
-
this.context.log(LogLevelLabel.INFO, "Generating documentation for the Powerlines project");
|
|
3423
|
+
this.context.log(LogLevelLabel.INFO, "\u{1F4D3} Generating documentation for the Powerlines project");
|
|
3544
3424
|
await this.prepare(inlineConfig);
|
|
3545
3425
|
await this.#executeEnvironments(async (context) => {
|
|
3546
|
-
context.log(LogLevelLabel.TRACE, "Writing
|
|
3547
|
-
await this.
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
await removeDirectory(outputPath);
|
|
3551
|
-
}
|
|
3552
|
-
await createDirectory(outputPath);
|
|
3553
|
-
await this.callNormalHook(context, "docs");
|
|
3554
|
-
const { generateDocs, getReflections } = await initTypedoc(context, {
|
|
3555
|
-
outputPath
|
|
3426
|
+
context.log(LogLevelLabel.TRACE, "Writing documentation for the Powerlines project artifacts.");
|
|
3427
|
+
await this.prepare(inlineConfig);
|
|
3428
|
+
await this.#executeEnvironments(async (context2) => {
|
|
3429
|
+
await this.callHook(context2, "docs");
|
|
3556
3430
|
});
|
|
3557
|
-
const project = await getReflections();
|
|
3558
|
-
if (project) {
|
|
3559
|
-
await generateDocs({
|
|
3560
|
-
project
|
|
3561
|
-
});
|
|
3562
|
-
}
|
|
3563
|
-
await this.callPostHook(context, "docs");
|
|
3564
3431
|
});
|
|
3565
3432
|
this.#context.log(LogLevelLabel.TRACE, "Powerlines documentation generation completed");
|
|
3566
3433
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMQKPEN3X_js = require('./chunk-MQKPEN3X.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 = chunkMQKPEN3X_js.withExecutor("prepare", executorFn);
|
|
23
23
|
var executor_default = executor;
|
|
24
24
|
|
|
25
25
|
exports.executorFn = executorFn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMQKPEN3X_js = require('./chunk-MQKPEN3X.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 = chunkMQKPEN3X_js.withExecutor("docs", executorFn);
|
|
15
15
|
var executor_default = executor;
|
|
16
16
|
|
|
17
17
|
exports.executorFn = executorFn;
|