@powerlines/plugin-webpack 0.5.126 → 0.5.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/helpers/index.cjs +3 -1
- package/dist/helpers/index.mjs +3 -1
- package/dist/helpers/unplugin.cjs +12 -1
- package/dist/helpers/unplugin.mjs +11 -1
- package/dist/index.cjs +39 -1
- package/dist/index.mjs +33 -1
- package/dist/powerlines/schemas/fs.cjs +226 -1
- package/dist/powerlines/schemas/fs.mjs +224 -1
- package/dist/powerlines/src/api.cjs +576 -9
- package/dist/powerlines/src/api.mjs +578 -1
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -1
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -1
- package/dist/powerlines/src/internal/helpers/environment.cjs +52 -1
- package/dist/powerlines/src/internal/helpers/environment.mjs +48 -1
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +50 -7
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +48 -7
- package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -1
- package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -1
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -3
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -3
- package/dist/powerlines/src/internal/helpers/install.cjs +37 -1
- package/dist/powerlines/src/internal/helpers/install.mjs +36 -1
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +97 -7
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +93 -7
- package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -1
- package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -1
- package/dist/powerlines/src/lib/build/webpack.cjs +47 -1
- package/dist/powerlines/src/lib/build/webpack.mjs +45 -1
- package/dist/powerlines/src/lib/config-file.cjs +79 -1
- package/dist/powerlines/src/lib/config-file.mjs +76 -1
- package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -1
- package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -1
- package/dist/powerlines/src/lib/contexts/context.cjs +931 -1
- package/dist/powerlines/src/lib/contexts/context.mjs +929 -1
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -1
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -1
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -1
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -1
- package/dist/powerlines/src/lib/entry.cjs +69 -1
- package/dist/powerlines/src/lib/entry.mjs +67 -1
- package/dist/powerlines/src/lib/fs/helpers.cjs +85 -1
- package/dist/powerlines/src/lib/fs/helpers.mjs +81 -1
- package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -1
- package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -1
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -1
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -1
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -1
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -1
- package/dist/powerlines/src/lib/fs/vfs.cjs +830 -1
- package/dist/powerlines/src/lib/fs/vfs.mjs +828 -1
- package/dist/powerlines/src/lib/logger.cjs +58 -1
- package/dist/powerlines/src/lib/logger.mjs +55 -1
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -1
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -1
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -4
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -4
- package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -1
- package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -1
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -1
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -1
- package/dist/powerlines/src/lib/unplugin/index.cjs +3 -1
- package/dist/powerlines/src/lib/unplugin/index.mjs +5 -1
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +127 -5
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +126 -5
- package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
- package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
- package/dist/powerlines/src/lib/utilities/meta.cjs +45 -1
- package/dist/powerlines/src/lib/utilities/meta.mjs +41 -1
- package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -1
- package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -1
- package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -1
- package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -1
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -1
- package/dist/powerlines/src/types/build.cjs +15 -1
- package/dist/powerlines/src/types/build.mjs +14 -1
- package/dist/powerlines/src/types/commands.cjs +16 -1
- package/dist/powerlines/src/types/commands.mjs +15 -1
- package/dist/powerlines/src/types/config.d.mts +1 -0
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/powerlines/src/types/plugin.cjs +32 -1
- package/dist/powerlines/src/types/plugin.mjs +31 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +9 -9
|
@@ -1 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let defu = require("defu");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/lib/unplugin/helpers.ts
|
|
5
|
+
/**
|
|
6
|
+
* Merges a base plugin context with an unplugin context, combining their properties.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The base plugin context to merge into.
|
|
9
|
+
* @param unplugin - The unplugin context to merge from.
|
|
10
|
+
* @returns The merged context.
|
|
11
|
+
*/
|
|
12
|
+
function combineContexts(context, unplugin) {
|
|
13
|
+
return (0, defu.defu)(context, unplugin);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.combineContexts = combineContexts;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{defu
|
|
1
|
+
import { defu } from "defu";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/lib/unplugin/helpers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Merges a base plugin context with an unplugin context, combining their properties.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The base plugin context to merge into.
|
|
8
|
+
* @param unplugin - The unplugin context to merge from.
|
|
9
|
+
* @returns The merged context.
|
|
10
|
+
*/
|
|
11
|
+
function combineContexts(context, unplugin) {
|
|
12
|
+
return defu(context, unplugin);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { combineContexts };
|
|
@@ -1,6 +1,128 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_logger = require('../logger.cjs');
|
|
3
|
+
const require_source_file = require('../utilities/source-file.cjs');
|
|
4
|
+
const require_helpers = require('./helpers.cjs');
|
|
5
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
+
let unplugin = require("unplugin");
|
|
7
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
8
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
//#region ../powerlines/src/lib/unplugin/plugin.ts
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Powerlines unplugin instance.
|
|
14
|
+
*
|
|
15
|
+
* @param context - The plugin context.
|
|
16
|
+
* @returns The unplugin instance.
|
|
17
|
+
*/
|
|
18
|
+
function createUnplugin(context) {
|
|
19
|
+
const ctx = context;
|
|
20
|
+
(0, unplugin.setParseImpl)(ctx.parse);
|
|
21
|
+
return () => {
|
|
22
|
+
const log = require_logger.extendLog(ctx.log, "unplugin");
|
|
23
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Initializing Unplugin");
|
|
24
|
+
try {
|
|
25
|
+
async function buildStart() {
|
|
26
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
27
|
+
await ctx.$$internal.callHook("buildStart", { sequential: true });
|
|
28
|
+
}
|
|
29
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
30
|
+
const resolved = await (async () => {
|
|
31
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
32
|
+
sequential: true,
|
|
33
|
+
result: "first",
|
|
34
|
+
order: "pre"
|
|
35
|
+
}, id, importer, opts);
|
|
36
|
+
if (result) return result;
|
|
37
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
38
|
+
sequential: true,
|
|
39
|
+
result: "first",
|
|
40
|
+
order: "normal"
|
|
41
|
+
}, id, importer, opts);
|
|
42
|
+
if (result) return result;
|
|
43
|
+
result = await ctx.resolve(id, importer, opts);
|
|
44
|
+
if (result) return result;
|
|
45
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
46
|
+
sequential: true,
|
|
47
|
+
result: "first",
|
|
48
|
+
order: "post"
|
|
49
|
+
}, id, importer, opts);
|
|
50
|
+
})();
|
|
51
|
+
if (resolved && opts.isEntry && ctx.config.build.polyfill && ctx.config.build.polyfill.length > 0) {
|
|
52
|
+
const entry = ctx.entry.find((entry$1) => entry$1.file === ((0, __stryke_type_checks_is_string.isString)(resolved) ? resolved : resolved.id));
|
|
53
|
+
if (entry) {
|
|
54
|
+
entry.file = `${(0, __stryke_path_replace.replaceExtension)((0, __stryke_type_checks_is_string.isString)(resolved) ? resolved : resolved.id)}-polyfill.ts`;
|
|
55
|
+
entry.output ||= entry.output?.replace((0, __stryke_path_file_path_fns.findFileName)(entry.output, { withExtension: true }), entry.file);
|
|
56
|
+
await ctx.emitEntry(`
|
|
57
|
+
${ctx.config.build.polyfill.map((p) => `import "${p}";`).join("\n")}
|
|
58
|
+
|
|
59
|
+
export * from "${(0, __stryke_type_checks_is_string.isString)(resolved) ? resolved : resolved.id}";
|
|
60
|
+
`, entry.file);
|
|
61
|
+
return entry.file;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return resolved;
|
|
65
|
+
}
|
|
66
|
+
async function load(id) {
|
|
67
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
68
|
+
sequential: true,
|
|
69
|
+
result: "first",
|
|
70
|
+
order: "pre"
|
|
71
|
+
}, id);
|
|
72
|
+
if (result) return result;
|
|
73
|
+
result = await ctx.$$internal.callHook("load", {
|
|
74
|
+
sequential: true,
|
|
75
|
+
result: "first",
|
|
76
|
+
order: "normal"
|
|
77
|
+
}, id);
|
|
78
|
+
if (result) return result;
|
|
79
|
+
result = await ctx.load(id);
|
|
80
|
+
if (result) return result;
|
|
81
|
+
return ctx.$$internal.callHook("load", {
|
|
82
|
+
sequential: true,
|
|
83
|
+
result: "first",
|
|
84
|
+
order: "post"
|
|
85
|
+
}, id);
|
|
86
|
+
}
|
|
87
|
+
async function transform(code, id) {
|
|
88
|
+
let transformed = code;
|
|
89
|
+
for (const handler of ctx.$$internal.environment.selectHooks("transform")) {
|
|
90
|
+
const result = await handler.handle.apply(require_helpers.combineContexts(ctx, this), [require_source_file.getString(transformed), id]);
|
|
91
|
+
if (result) transformed = result;
|
|
92
|
+
}
|
|
93
|
+
return transformed;
|
|
94
|
+
}
|
|
95
|
+
async function buildEnd() {
|
|
96
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
|
|
97
|
+
return ctx.$$internal.callHook("buildEnd", { sequential: true });
|
|
98
|
+
}
|
|
99
|
+
async function writeBundle() {
|
|
100
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
101
|
+
return ctx.$$internal.callHook("writeBundle", { sequential: true });
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
name: "powerlines",
|
|
105
|
+
api: ctx.$$internal.api,
|
|
106
|
+
resolveId: {
|
|
107
|
+
filter: { id: { include: [/.*/] } },
|
|
108
|
+
handler: resolveId
|
|
109
|
+
},
|
|
110
|
+
load: {
|
|
111
|
+
filter: { id: { include: [/.*/] } },
|
|
112
|
+
handler: load
|
|
113
|
+
},
|
|
114
|
+
transform,
|
|
115
|
+
buildStart,
|
|
116
|
+
buildEnd,
|
|
117
|
+
writeBundle,
|
|
118
|
+
vite: { sharedDuringBuild: true }
|
|
119
|
+
};
|
|
120
|
+
} catch (error) {
|
|
121
|
+
log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
exports.createUnplugin = createUnplugin;
|
|
@@ -1,6 +1,127 @@
|
|
|
1
|
-
import{extendLog
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { extendLog } from "../logger.mjs";
|
|
2
|
+
import { getString } from "../utilities/source-file.mjs";
|
|
3
|
+
import { combineContexts } from "./helpers.mjs";
|
|
4
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
|
+
import { setParseImpl } from "unplugin";
|
|
6
|
+
import { replaceExtension } from "@stryke/path/replace";
|
|
7
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
+
import { findFileName } from "@stryke/path/file-path-fns";
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
//#region ../powerlines/src/lib/unplugin/plugin.ts
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Powerlines unplugin instance.
|
|
13
|
+
*
|
|
14
|
+
* @param context - The plugin context.
|
|
15
|
+
* @returns The unplugin instance.
|
|
16
|
+
*/
|
|
17
|
+
function createUnplugin(context) {
|
|
18
|
+
const ctx = context;
|
|
19
|
+
setParseImpl(ctx.parse);
|
|
20
|
+
return () => {
|
|
21
|
+
const log = extendLog(ctx.log, "unplugin");
|
|
22
|
+
log(LogLevelLabel.DEBUG, "Initializing Unplugin");
|
|
23
|
+
try {
|
|
24
|
+
async function buildStart() {
|
|
25
|
+
log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
26
|
+
await ctx.$$internal.callHook("buildStart", { sequential: true });
|
|
27
|
+
}
|
|
28
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
29
|
+
const resolved = await (async () => {
|
|
30
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
31
|
+
sequential: true,
|
|
32
|
+
result: "first",
|
|
33
|
+
order: "pre"
|
|
34
|
+
}, id, importer, opts);
|
|
35
|
+
if (result) return result;
|
|
36
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
37
|
+
sequential: true,
|
|
38
|
+
result: "first",
|
|
39
|
+
order: "normal"
|
|
40
|
+
}, id, importer, opts);
|
|
41
|
+
if (result) return result;
|
|
42
|
+
result = await ctx.resolve(id, importer, opts);
|
|
43
|
+
if (result) return result;
|
|
44
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
45
|
+
sequential: true,
|
|
46
|
+
result: "first",
|
|
47
|
+
order: "post"
|
|
48
|
+
}, id, importer, opts);
|
|
49
|
+
})();
|
|
50
|
+
if (resolved && opts.isEntry && ctx.config.build.polyfill && ctx.config.build.polyfill.length > 0) {
|
|
51
|
+
const entry = ctx.entry.find((entry$1) => entry$1.file === (isString(resolved) ? resolved : resolved.id));
|
|
52
|
+
if (entry) {
|
|
53
|
+
entry.file = `${replaceExtension(isString(resolved) ? resolved : resolved.id)}-polyfill.ts`;
|
|
54
|
+
entry.output ||= entry.output?.replace(findFileName(entry.output, { withExtension: true }), entry.file);
|
|
55
|
+
await ctx.emitEntry(`
|
|
56
|
+
${ctx.config.build.polyfill.map((p) => `import "${p}";`).join("\n")}
|
|
57
|
+
|
|
58
|
+
export * from "${isString(resolved) ? resolved : resolved.id}";
|
|
59
|
+
`, entry.file);
|
|
60
|
+
return entry.file;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return resolved;
|
|
64
|
+
}
|
|
65
|
+
async function load(id) {
|
|
66
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
67
|
+
sequential: true,
|
|
68
|
+
result: "first",
|
|
69
|
+
order: "pre"
|
|
70
|
+
}, id);
|
|
71
|
+
if (result) return result;
|
|
72
|
+
result = await ctx.$$internal.callHook("load", {
|
|
73
|
+
sequential: true,
|
|
74
|
+
result: "first",
|
|
75
|
+
order: "normal"
|
|
76
|
+
}, id);
|
|
77
|
+
if (result) return result;
|
|
78
|
+
result = await ctx.load(id);
|
|
79
|
+
if (result) return result;
|
|
80
|
+
return ctx.$$internal.callHook("load", {
|
|
81
|
+
sequential: true,
|
|
82
|
+
result: "first",
|
|
83
|
+
order: "post"
|
|
84
|
+
}, id);
|
|
85
|
+
}
|
|
86
|
+
async function transform(code, id) {
|
|
87
|
+
let transformed = code;
|
|
88
|
+
for (const handler of ctx.$$internal.environment.selectHooks("transform")) {
|
|
89
|
+
const result = await handler.handle.apply(combineContexts(ctx, this), [getString(transformed), id]);
|
|
90
|
+
if (result) transformed = result;
|
|
91
|
+
}
|
|
92
|
+
return transformed;
|
|
93
|
+
}
|
|
94
|
+
async function buildEnd() {
|
|
95
|
+
log(LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
|
|
96
|
+
return ctx.$$internal.callHook("buildEnd", { sequential: true });
|
|
97
|
+
}
|
|
98
|
+
async function writeBundle() {
|
|
99
|
+
log(LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
|
|
100
|
+
return ctx.$$internal.callHook("writeBundle", { sequential: true });
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
name: "powerlines",
|
|
104
|
+
api: ctx.$$internal.api,
|
|
105
|
+
resolveId: {
|
|
106
|
+
filter: { id: { include: [/.*/] } },
|
|
107
|
+
handler: resolveId
|
|
108
|
+
},
|
|
109
|
+
load: {
|
|
110
|
+
filter: { id: { include: [/.*/] } },
|
|
111
|
+
handler: load
|
|
112
|
+
},
|
|
113
|
+
transform,
|
|
114
|
+
buildStart,
|
|
115
|
+
buildEnd,
|
|
116
|
+
writeBundle,
|
|
117
|
+
vite: { sharedDuringBuild: true }
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
log(LogLevelLabel.FATAL, error?.message);
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
export { createUnplugin };
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
5
|
+
function getBaseFileHeader(context) {
|
|
6
|
+
return `
|
|
7
|
+
// Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
|
|
3
8
|
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4
|
-
|
|
9
|
+
`;
|
|
10
|
+
}
|
|
11
|
+
function getFileHeader(context, options = {}) {
|
|
12
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
13
|
+
return `/* eslint-disable */
|
|
5
14
|
// biome-ignore lint: disable
|
|
6
|
-
${
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
16
|
+
${getBaseFileHeader(context)}
|
|
17
|
+
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.getFileHeader = getFileHeader;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import{titleCase
|
|
2
|
-
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
4
|
+
function getBaseFileHeader(context) {
|
|
5
|
+
return `
|
|
6
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
3
7
|
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4
|
-
|
|
8
|
+
`;
|
|
9
|
+
}
|
|
10
|
+
function getFileHeader(context, options = {}) {
|
|
11
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
12
|
+
return `/* eslint-disable */
|
|
5
13
|
// biome-ignore lint: disable
|
|
6
|
-
${
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
15
|
+
${getBaseFileHeader(context)}
|
|
16
|
+
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getFileHeader };
|
|
@@ -1 +1,45 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
3
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
|
+
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
5
|
+
let __stryke_fs_json = require("@stryke/fs/json");
|
|
6
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
7
|
+
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
8
|
+
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
9
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
10
|
+
require("@stryke/fs/remove-file");
|
|
11
|
+
|
|
12
|
+
//#region ../powerlines/src/lib/utilities/meta.ts
|
|
13
|
+
const PROJECT_ROOT_HASH_LENGTH = 45;
|
|
14
|
+
const CACHE_HASH_LENGTH = 62;
|
|
15
|
+
/**
|
|
16
|
+
* Generates a prefixed project root hash object.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* This function returns a string where the project root hash is prefixed with the project name plus a hyphen. If the total length of this string combination exceeds 45 characters, it will truncate the hash.
|
|
20
|
+
*
|
|
21
|
+
* @param name - The name of the project.
|
|
22
|
+
* @param projectRootHash - The hash of the project root.
|
|
23
|
+
* @returns An object containing the name and project root hash.
|
|
24
|
+
*/
|
|
25
|
+
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
26
|
+
const combined = `${(0, __stryke_string_format_kebab_case.kebabCase)(name)}_${projectRootHash}`;
|
|
27
|
+
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Writes the meta file for the context.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The context to write the meta file for.
|
|
33
|
+
* @returns A promise that resolves when the meta file has been written.
|
|
34
|
+
*/
|
|
35
|
+
async function writeMetaFile(context) {
|
|
36
|
+
const metaFilePath = (0, __stryke_path_join_paths.joinPaths)(context.dataPath, "meta.json");
|
|
37
|
+
context.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
38
|
+
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.CACHE_HASH_LENGTH = CACHE_HASH_LENGTH;
|
|
43
|
+
exports.PROJECT_ROOT_HASH_LENGTH = PROJECT_ROOT_HASH_LENGTH;
|
|
44
|
+
exports.getPrefixedProjectRootHash = getPrefixedProjectRootHash;
|
|
45
|
+
exports.writeMetaFile = writeMetaFile;
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
import{LogLevelLabel
|
|
1
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
2
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
|
+
import { listFiles } from "@stryke/fs/list-files";
|
|
4
|
+
import { readJsonFile } from "@stryke/fs/json";
|
|
5
|
+
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
6
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
7
|
+
import { getUnique } from "@stryke/helpers/get-unique";
|
|
8
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
9
|
+
import "@stryke/fs/remove-file";
|
|
10
|
+
|
|
11
|
+
//#region ../powerlines/src/lib/utilities/meta.ts
|
|
12
|
+
const PROJECT_ROOT_HASH_LENGTH = 45;
|
|
13
|
+
const CACHE_HASH_LENGTH = 62;
|
|
14
|
+
/**
|
|
15
|
+
* Generates a prefixed project root hash object.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This function returns a string where the project root hash is prefixed with the project name plus a hyphen. If the total length of this string combination exceeds 45 characters, it will truncate the hash.
|
|
19
|
+
*
|
|
20
|
+
* @param name - The name of the project.
|
|
21
|
+
* @param projectRootHash - The hash of the project root.
|
|
22
|
+
* @returns An object containing the name and project root hash.
|
|
23
|
+
*/
|
|
24
|
+
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
25
|
+
const combined = `${kebabCase(name)}_${projectRootHash}`;
|
|
26
|
+
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Writes the meta file for the context.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The context to write the meta file for.
|
|
32
|
+
* @returns A promise that resolves when the meta file has been written.
|
|
33
|
+
*/
|
|
34
|
+
async function writeMetaFile(context) {
|
|
35
|
+
const metaFilePath = joinPaths(context.dataPath, "meta.json");
|
|
36
|
+
context.log(LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
37
|
+
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { CACHE_HASH_LENGTH, PROJECT_ROOT_HASH_LENGTH, getPrefixedProjectRootHash, writeMetaFile };
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
3
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
4
|
+
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
5
|
+
require("magic-string");
|
|
6
|
+
|
|
7
|
+
//#region ../powerlines/src/lib/utilities/source-file.ts
|
|
8
|
+
/**
|
|
9
|
+
* Get the string from the source.
|
|
10
|
+
*
|
|
11
|
+
* @param code - The source string or magic string.
|
|
12
|
+
* @returns The source string.
|
|
13
|
+
*/
|
|
14
|
+
function getString(code) {
|
|
15
|
+
if (!code) return "";
|
|
16
|
+
if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
|
|
17
|
+
if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
|
|
18
|
+
return code.toString();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.getString = getString;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import{isSetObject
|
|
1
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
2
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
3
|
+
import "@stryke/fs/read-file";
|
|
4
|
+
import "magic-string";
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/lib/utilities/source-file.ts
|
|
7
|
+
/**
|
|
8
|
+
* Get the string from the source.
|
|
9
|
+
*
|
|
10
|
+
* @param code - The source string or magic string.
|
|
11
|
+
* @returns The source string.
|
|
12
|
+
*/
|
|
13
|
+
function getString(code) {
|
|
14
|
+
if (!code) return "";
|
|
15
|
+
if (isString(code)) return code;
|
|
16
|
+
if (isSetObject(code) && "code" in code) return code.code;
|
|
17
|
+
return code.toString();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getString };
|