@powerlines/plugin-nodejs 0.1.115 → 0.1.117
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/components/env.cjs +14 -14
- package/dist/components/env.mjs +6 -6
- package/dist/deepkit/schemas/reflection.cjs +3998 -0
- package/dist/deepkit/schemas/reflection.mjs +3996 -0
- package/dist/deepkit/schemas/reflection2.cjs +4112 -0
- package/dist/deepkit/schemas/reflection2.mjs +4110 -0
- package/dist/deepkit/src/capnp.cjs +913 -0
- package/dist/deepkit/src/capnp.mjs +911 -0
- package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
- package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
- package/dist/deepkit/src/reflect-type.cjs +22 -0
- package/dist/deepkit/src/reflect-type.mjs +20 -0
- package/dist/deepkit/src/resolve-reflections.cjs +16 -0
- package/dist/deepkit/src/resolve-reflections.mjs +15 -0
- package/dist/deepkit/src/transformer.cjs +52 -0
- package/dist/deepkit/src/transformer.mjs +49 -0
- package/dist/deepkit/src/transpile.cjs +29 -0
- package/dist/deepkit/src/transpile.mjs +27 -0
- package/dist/deepkit/src/utilities.cjs +67 -0
- package/dist/deepkit/src/utilities.mjs +66 -0
- package/dist/index.cjs +6 -8
- package/dist/index.mjs +5 -5
- package/dist/plugin-alloy/src/core/components/output.cjs +43 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +42 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +49 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +44 -0
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
- package/dist/plugin-alloy/src/index.cjs +105 -0
- package/dist/plugin-alloy/src/index.mjs +103 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +18 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
- package/dist/plugin-alloy/src/types/components.d.mts +2 -1
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +62 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +61 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +131 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +129 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +451 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +442 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +216 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +1 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +213 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +72 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +2 -2
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +71 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
- package/dist/plugin-automd/src/index.cjs +101 -0
- package/dist/plugin-automd/src/index.mjs +98 -0
- package/dist/plugin-automd/src/types/plugin.d.mts +3 -1
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
- package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
- package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
- package/dist/plugin-babel/src/helpers/index.cjs +5 -0
- package/dist/plugin-babel/src/helpers/index.mjs +7 -0
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
- package/dist/plugin-babel/src/helpers/options.cjs +49 -0
- package/dist/plugin-babel/src/helpers/options.mjs +46 -0
- package/dist/plugin-babel/src/index.cjs +85 -0
- package/dist/plugin-babel/src/index.mjs +83 -0
- package/dist/plugin-babel/src/types/index.d.mts +1 -0
- package/dist/plugin-env/src/babel/index.cjs +1 -0
- package/dist/plugin-env/src/babel/index.mjs +3 -0
- package/dist/plugin-env/src/babel/plugin.cjs +70 -0
- package/dist/plugin-env/src/babel/plugin.mjs +69 -0
- package/dist/plugin-env/src/components/docs.cjs +70 -0
- package/dist/plugin-env/src/components/docs.mjs +69 -0
- package/dist/plugin-env/src/components/env.cjs +589 -0
- package/dist/plugin-env/src/components/env.mjs +586 -0
- package/dist/plugin-env/src/components/index.cjs +2 -0
- package/dist/plugin-env/src/components/index.mjs +4 -0
- package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
- package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
- package/dist/plugin-env/src/helpers/docs-helper.cjs +16 -0
- package/dist/plugin-env/src/helpers/docs-helper.mjs +15 -0
- package/dist/plugin-env/src/helpers/index.cjs +6 -0
- package/dist/plugin-env/src/helpers/index.mjs +8 -0
- package/dist/plugin-env/src/helpers/load.cjs +84 -0
- package/dist/plugin-env/src/helpers/load.mjs +81 -0
- package/dist/plugin-env/src/helpers/persistence.cjs +201 -0
- package/dist/plugin-env/src/helpers/persistence.mjs +190 -0
- package/dist/plugin-env/src/helpers/reflect.cjs +125 -0
- package/dist/plugin-env/src/helpers/reflect.mjs +117 -0
- package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
- package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
- package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
- package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
- package/dist/plugin-env/src/index.cjs +177 -0
- package/dist/plugin-env/src/index.mjs +175 -0
- package/dist/plugin-env/src/types/plugin.d.mts +2 -1
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +2 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +93 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +91 -0
- package/dist/powerlines/src/lib/constants/environments.cjs +6 -0
- package/dist/powerlines/src/lib/constants/environments.mjs +5 -0
- package/dist/powerlines/src/lib/entry.cjs +11 -0
- package/dist/powerlines/src/lib/entry.mjs +13 -0
- package/dist/powerlines/src/lib/logger.cjs +41 -0
- package/dist/powerlines/src/lib/logger.mjs +39 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -0
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +3 -0
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +5 -0
- package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +66 -0
- package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +65 -0
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +46 -0
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +45 -0
- package/dist/powerlines/src/lib/utilities/bundle.cjs +42 -0
- package/dist/powerlines/src/lib/utilities/bundle.mjs +40 -0
- package/dist/powerlines/src/lib/utilities/resolve.cjs +50 -0
- package/dist/powerlines/src/lib/utilities/resolve.mjs +49 -0
- package/dist/powerlines/src/lib/utilities/source-file.cjs +5 -0
- package/dist/powerlines/src/lib/utilities/source-file.mjs +5 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
- package/dist/powerlines/src/types/build.cjs +21 -0
- package/dist/powerlines/src/types/build.d.mts +6 -6
- package/dist/powerlines/src/types/build.mjs +21 -0
- package/dist/powerlines/src/types/commands.d.mts +1 -0
- package/dist/powerlines/src/types/config.d.mts +3 -2
- package/dist/powerlines/src/types/context.d.mts +2 -2
- package/dist/powerlines/src/types/plugin.d.mts +1 -1
- package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
- package/dist/powerlines/src/types/unplugin.d.mts +2 -1
- package/package.json +6 -6
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
require('../entry.cjs');
|
|
3
|
+
let defu = require("defu");
|
|
4
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
5
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
6
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
7
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
|
+
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
10
|
+
|
|
11
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
12
|
+
const DEFAULT_ESBUILD_CONFIG = {
|
|
13
|
+
target: "esnext",
|
|
14
|
+
platform: "neutral",
|
|
15
|
+
format: "esm",
|
|
16
|
+
write: true,
|
|
17
|
+
minify: true,
|
|
18
|
+
sourcemap: false,
|
|
19
|
+
bundle: true,
|
|
20
|
+
treeShaking: true,
|
|
21
|
+
keepNames: true,
|
|
22
|
+
splitting: true,
|
|
23
|
+
logLevel: "silent"
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the esbuild options.
|
|
27
|
+
*
|
|
28
|
+
* @param context - The build context.
|
|
29
|
+
* @returns The resolved esbuild options.
|
|
30
|
+
*/
|
|
31
|
+
function extractESBuildConfig(context) {
|
|
32
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
33
|
+
if (inject && Object.keys(inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
34
|
+
if (value) if (Array.isArray(value)) {
|
|
35
|
+
if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
|
|
36
|
+
if (value.length === 1) return `
|
|
37
|
+
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
38
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
39
|
+
else if (value.length > 1) return `
|
|
40
|
+
import ${value[1] === "*" ? `* as ${(0, __stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, __stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
|
|
41
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
42
|
+
} else if (value.length === 1) return `
|
|
43
|
+
import ${key} from "${value[0]}";
|
|
44
|
+
export { ${key} };`;
|
|
45
|
+
else if (value.length > 1) return `
|
|
46
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
47
|
+
export { ${key} };`;
|
|
48
|
+
} else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
|
|
49
|
+
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
50
|
+
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
51
|
+
else return `
|
|
52
|
+
import ${key} from "${value}";
|
|
53
|
+
export { ${key} };`;
|
|
54
|
+
return "";
|
|
55
|
+
}).join("\n"));
|
|
56
|
+
return (0, defu.default)({
|
|
57
|
+
alias: context.alias,
|
|
58
|
+
inject: inject && Object.keys(inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
|
|
59
|
+
}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
|
|
60
|
+
"alias",
|
|
61
|
+
"inject",
|
|
62
|
+
"external",
|
|
63
|
+
"noExternal",
|
|
64
|
+
"skipNodeModulesBundle",
|
|
65
|
+
"extensions"
|
|
66
|
+
]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
|
|
67
|
+
"alias",
|
|
68
|
+
"inject",
|
|
69
|
+
"external",
|
|
70
|
+
"noExternal",
|
|
71
|
+
"skipNodeModulesBundle",
|
|
72
|
+
"extensions",
|
|
73
|
+
"variant",
|
|
74
|
+
"override"
|
|
75
|
+
]) : {}, {
|
|
76
|
+
mainFields: context.config.build.mainFields,
|
|
77
|
+
conditions: context.config.build.conditions,
|
|
78
|
+
define: context.config.build.define,
|
|
79
|
+
resolveExtensions: context.config.build.extensions,
|
|
80
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
81
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
82
|
+
platform: context.config.build.platform,
|
|
83
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
84
|
+
outdir: context.config.output.buildPath,
|
|
85
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
86
|
+
minify: context.config.mode !== "development",
|
|
87
|
+
metafile: context.config.mode === "development",
|
|
88
|
+
sourcemap: context.config.mode === "development"
|
|
89
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.extractESBuildConfig = extractESBuildConfig;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import "../entry.mjs";
|
|
2
|
+
import defu from "defu";
|
|
3
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
4
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
5
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
7
|
+
import { omit } from "@stryke/helpers/omit";
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/lib/build/esbuild.ts
|
|
10
|
+
const DEFAULT_ESBUILD_CONFIG = {
|
|
11
|
+
target: "esnext",
|
|
12
|
+
platform: "neutral",
|
|
13
|
+
format: "esm",
|
|
14
|
+
write: true,
|
|
15
|
+
minify: true,
|
|
16
|
+
sourcemap: false,
|
|
17
|
+
bundle: true,
|
|
18
|
+
treeShaking: true,
|
|
19
|
+
keepNames: true,
|
|
20
|
+
splitting: true,
|
|
21
|
+
logLevel: "silent"
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the esbuild options.
|
|
25
|
+
*
|
|
26
|
+
* @param context - The build context.
|
|
27
|
+
* @returns The resolved esbuild options.
|
|
28
|
+
*/
|
|
29
|
+
function extractESBuildConfig(context) {
|
|
30
|
+
const inject = context.config.build.override.inject ?? context.config.build.inject;
|
|
31
|
+
if (inject && Object.keys(inject).length > 0) context.fs.writeSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
|
|
32
|
+
if (value) if (Array.isArray(value)) {
|
|
33
|
+
if (camelCase(key) !== key) {
|
|
34
|
+
if (value.length === 1) return `
|
|
35
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
36
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
37
|
+
else if (value.length > 1) return `
|
|
38
|
+
import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
|
|
39
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
40
|
+
} else if (value.length === 1) return `
|
|
41
|
+
import ${key} from "${value[0]}";
|
|
42
|
+
export { ${key} };`;
|
|
43
|
+
else if (value.length > 1) return `
|
|
44
|
+
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
45
|
+
export { ${key} };`;
|
|
46
|
+
} else if (camelCase(key) !== key) return `
|
|
47
|
+
import ${camelCase(key)} from "${value[0]}";
|
|
48
|
+
export { ${camelCase(key)} as "${key}" }`;
|
|
49
|
+
else return `
|
|
50
|
+
import ${key} from "${value}";
|
|
51
|
+
export { ${key} };`;
|
|
52
|
+
return "";
|
|
53
|
+
}).join("\n"));
|
|
54
|
+
return defu({
|
|
55
|
+
alias: context.alias,
|
|
56
|
+
inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
|
|
57
|
+
}, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
|
|
58
|
+
"alias",
|
|
59
|
+
"inject",
|
|
60
|
+
"external",
|
|
61
|
+
"noExternal",
|
|
62
|
+
"skipNodeModulesBundle",
|
|
63
|
+
"extensions"
|
|
64
|
+
]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
|
|
65
|
+
"alias",
|
|
66
|
+
"inject",
|
|
67
|
+
"external",
|
|
68
|
+
"noExternal",
|
|
69
|
+
"skipNodeModulesBundle",
|
|
70
|
+
"extensions",
|
|
71
|
+
"variant",
|
|
72
|
+
"override"
|
|
73
|
+
]) : {}, {
|
|
74
|
+
mainFields: context.config.build.mainFields,
|
|
75
|
+
conditions: context.config.build.conditions,
|
|
76
|
+
define: context.config.build.define,
|
|
77
|
+
resolveExtensions: context.config.build.extensions,
|
|
78
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
79
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
80
|
+
platform: context.config.build.platform,
|
|
81
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
82
|
+
outdir: context.config.output.buildPath,
|
|
83
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
84
|
+
minify: context.config.mode !== "development",
|
|
85
|
+
metafile: context.config.mode === "development",
|
|
86
|
+
sourcemap: context.config.mode === "development"
|
|
87
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { extractESBuildConfig };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require('../plugin-utils/paths.cjs');
|
|
2
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
3
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
4
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
5
|
+
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
7
|
+
let __stryke_path_is_type = require("@stryke/path/is-type");
|
|
8
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
9
|
+
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
10
|
+
let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
11
|
+
require("@stryke/hash/murmurhash");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../plugin-utils/paths.mjs";
|
|
2
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
3
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
4
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
5
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
6
|
+
import { appendPath } from "@stryke/path/append";
|
|
7
|
+
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
8
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
10
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
11
|
+
import "@stryke/hash/murmurhash";
|
|
12
|
+
|
|
13
|
+
export { };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let chalk = require("chalk");
|
|
3
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
4
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
|
+
require("@storm-software/config-tools/logger");
|
|
6
|
+
require("@storm-software/config-tools/utilities/colors");
|
|
7
|
+
require("@stryke/helpers/noop");
|
|
8
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
9
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
+
|
|
11
|
+
//#region ../powerlines/src/lib/logger.ts
|
|
12
|
+
const BADGE_COLORS = [
|
|
13
|
+
"#00A0DD",
|
|
14
|
+
"#6FCE4E",
|
|
15
|
+
"#FBBF24",
|
|
16
|
+
"#F43F5E",
|
|
17
|
+
"#3B82F6",
|
|
18
|
+
"#A855F7",
|
|
19
|
+
"#469592",
|
|
20
|
+
"#288EDF",
|
|
21
|
+
"#D8B4FE",
|
|
22
|
+
"#10B981",
|
|
23
|
+
"#EF4444",
|
|
24
|
+
"#F0EC56",
|
|
25
|
+
"#F472B6",
|
|
26
|
+
"#22D3EE",
|
|
27
|
+
"#EAB308",
|
|
28
|
+
"#84CC16",
|
|
29
|
+
"#F87171",
|
|
30
|
+
"#0EA5E9",
|
|
31
|
+
"#D946EF",
|
|
32
|
+
"#FACC15",
|
|
33
|
+
"#34D399",
|
|
34
|
+
"#8B5CF6"
|
|
35
|
+
];
|
|
36
|
+
const extendLog = (logFn, name) => {
|
|
37
|
+
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.extendLog = extendLog;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
+
import "@storm-software/config-tools/logger";
|
|
4
|
+
import "@storm-software/config-tools/utilities/colors";
|
|
5
|
+
import "@stryke/helpers/noop";
|
|
6
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
|
|
9
|
+
//#region ../powerlines/src/lib/logger.ts
|
|
10
|
+
const BADGE_COLORS = [
|
|
11
|
+
"#00A0DD",
|
|
12
|
+
"#6FCE4E",
|
|
13
|
+
"#FBBF24",
|
|
14
|
+
"#F43F5E",
|
|
15
|
+
"#3B82F6",
|
|
16
|
+
"#A855F7",
|
|
17
|
+
"#469592",
|
|
18
|
+
"#288EDF",
|
|
19
|
+
"#D8B4FE",
|
|
20
|
+
"#10B981",
|
|
21
|
+
"#EF4444",
|
|
22
|
+
"#F0EC56",
|
|
23
|
+
"#F472B6",
|
|
24
|
+
"#22D3EE",
|
|
25
|
+
"#EAB308",
|
|
26
|
+
"#84CC16",
|
|
27
|
+
"#F87171",
|
|
28
|
+
"#0EA5E9",
|
|
29
|
+
"#D946EF",
|
|
30
|
+
"#FACC15",
|
|
31
|
+
"#34D399",
|
|
32
|
+
"#8B5CF6"
|
|
33
|
+
];
|
|
34
|
+
const extendLog = (logFn, name) => {
|
|
35
|
+
return (type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { extendLog };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let defu = require("defu");
|
|
3
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
4
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
+
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
7
|
+
let typescript = require("typescript");
|
|
8
|
+
typescript = require_rolldown_runtime.__toESM(typescript);
|
|
9
|
+
require("@stryke/fs/json");
|
|
10
|
+
|
|
11
|
+
//#region ../powerlines/src/lib/typescript/tsconfig.ts
|
|
12
|
+
/**
|
|
13
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
14
|
+
*
|
|
15
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
16
|
+
* @param types - An array of type names to check against.
|
|
17
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
function findMatch(tsconfigType, types, extensions = [
|
|
20
|
+
".ts",
|
|
21
|
+
".tsx",
|
|
22
|
+
".d.ts"
|
|
23
|
+
]) {
|
|
24
|
+
return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
28
|
+
*
|
|
29
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
30
|
+
* @param types - An array of type names to check against.
|
|
31
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
32
|
+
*/
|
|
33
|
+
function isMatchFound(tsconfigType, types) {
|
|
34
|
+
return findMatch(tsconfigType, types) !== void 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.isMatchFound = isMatchFound;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import defu from "defu";
|
|
2
|
+
import { appendPath } from "@stryke/path/append";
|
|
3
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
4
|
+
import { existsSync } from "@stryke/fs/exists";
|
|
5
|
+
import ts from "typescript";
|
|
6
|
+
import "@stryke/fs/json";
|
|
7
|
+
|
|
8
|
+
//#region ../powerlines/src/lib/typescript/tsconfig.ts
|
|
9
|
+
/**
|
|
10
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
11
|
+
*
|
|
12
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
13
|
+
* @param types - An array of type names to check against.
|
|
14
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
function findMatch(tsconfigType, types, extensions = [
|
|
17
|
+
".ts",
|
|
18
|
+
".tsx",
|
|
19
|
+
".d.ts"
|
|
20
|
+
]) {
|
|
21
|
+
return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if the TypeScript configuration type matches any of the provided types.
|
|
25
|
+
*
|
|
26
|
+
* @param tsconfigType - The type from the TypeScript configuration.
|
|
27
|
+
* @param types - An array of type names to check against.
|
|
28
|
+
* @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
function isMatchFound(tsconfigType, types) {
|
|
31
|
+
return findMatch(tsconfigType, types) !== void 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { isMatchFound };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../powerlines/src/lib/unplugin/module-resolution.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This includes the `resolveId` and `load` hooks.
|
|
8
|
+
*
|
|
9
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
10
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
11
|
+
*
|
|
12
|
+
* @param context - The plugin context.
|
|
13
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
14
|
+
*/
|
|
15
|
+
function createUnpluginModuleResolutionFunctions(context) {
|
|
16
|
+
const ctx = context;
|
|
17
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
18
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
19
|
+
sequential: true,
|
|
20
|
+
result: "first",
|
|
21
|
+
order: "pre"
|
|
22
|
+
}, id, importer, opts);
|
|
23
|
+
if (result) return result;
|
|
24
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
25
|
+
sequential: true,
|
|
26
|
+
result: "first",
|
|
27
|
+
order: "normal"
|
|
28
|
+
}, id, importer, opts);
|
|
29
|
+
if (result) return result;
|
|
30
|
+
result = await ctx.resolve(id, importer, opts);
|
|
31
|
+
if (result) return result;
|
|
32
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
33
|
+
sequential: true,
|
|
34
|
+
result: "first",
|
|
35
|
+
order: "post"
|
|
36
|
+
}, id, importer, opts);
|
|
37
|
+
}
|
|
38
|
+
async function load(id) {
|
|
39
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
40
|
+
sequential: true,
|
|
41
|
+
result: "first",
|
|
42
|
+
order: "pre"
|
|
43
|
+
}, id);
|
|
44
|
+
if (result) return result;
|
|
45
|
+
result = await ctx.$$internal.callHook("load", {
|
|
46
|
+
sequential: true,
|
|
47
|
+
result: "first",
|
|
48
|
+
order: "normal"
|
|
49
|
+
}, id);
|
|
50
|
+
if (result) return result;
|
|
51
|
+
result = await ctx.load(id);
|
|
52
|
+
if (result) return result;
|
|
53
|
+
return ctx.$$internal.callHook("load", {
|
|
54
|
+
sequential: true,
|
|
55
|
+
result: "first",
|
|
56
|
+
order: "post"
|
|
57
|
+
}, id);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
resolveId,
|
|
61
|
+
load
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region ../powerlines/src/lib/unplugin/module-resolution.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This includes the `resolveId` and `load` hooks.
|
|
7
|
+
*
|
|
8
|
+
* @see https://rollupjs.org/plugin-development/#resolveid
|
|
9
|
+
* @see https://rollupjs.org/plugin-development/#load
|
|
10
|
+
*
|
|
11
|
+
* @param context - The plugin context.
|
|
12
|
+
* @returns The module resolution hooks (`resolveId` and `load`).
|
|
13
|
+
*/
|
|
14
|
+
function createUnpluginModuleResolutionFunctions(context) {
|
|
15
|
+
const ctx = context;
|
|
16
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
17
|
+
let result = await ctx.$$internal.callHook("resolveId", {
|
|
18
|
+
sequential: true,
|
|
19
|
+
result: "first",
|
|
20
|
+
order: "pre"
|
|
21
|
+
}, id, importer, opts);
|
|
22
|
+
if (result) return result;
|
|
23
|
+
result = await ctx.$$internal.callHook("resolveId", {
|
|
24
|
+
sequential: true,
|
|
25
|
+
result: "first",
|
|
26
|
+
order: "normal"
|
|
27
|
+
}, id, importer, opts);
|
|
28
|
+
if (result) return result;
|
|
29
|
+
result = await ctx.resolve(id, importer, opts);
|
|
30
|
+
if (result) return result;
|
|
31
|
+
return ctx.$$internal.callHook("resolveId", {
|
|
32
|
+
sequential: true,
|
|
33
|
+
result: "first",
|
|
34
|
+
order: "post"
|
|
35
|
+
}, id, importer, opts);
|
|
36
|
+
}
|
|
37
|
+
async function load(id) {
|
|
38
|
+
let result = await ctx.$$internal.callHook("load", {
|
|
39
|
+
sequential: true,
|
|
40
|
+
result: "first",
|
|
41
|
+
order: "pre"
|
|
42
|
+
}, id);
|
|
43
|
+
if (result) return result;
|
|
44
|
+
result = await ctx.$$internal.callHook("load", {
|
|
45
|
+
sequential: true,
|
|
46
|
+
result: "first",
|
|
47
|
+
order: "normal"
|
|
48
|
+
}, id);
|
|
49
|
+
if (result) return result;
|
|
50
|
+
result = await ctx.load(id);
|
|
51
|
+
if (result) return result;
|
|
52
|
+
return ctx.$$internal.callHook("load", {
|
|
53
|
+
sequential: true,
|
|
54
|
+
result: "first",
|
|
55
|
+
order: "post"
|
|
56
|
+
}, id);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
resolveId,
|
|
60
|
+
load
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { createUnpluginModuleResolutionFunctions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_logger = require('../logger.cjs');
|
|
3
|
+
require('../utilities/source-file.cjs');
|
|
4
|
+
require('./helpers.cjs');
|
|
5
|
+
const require_module_resolution = require('./module-resolution.cjs');
|
|
6
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
8
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
9
|
+
let unplugin = require("unplugin");
|
|
10
|
+
|
|
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 createUnpluginResolver(context, name = "unplugin") {
|
|
19
|
+
const ctx = context;
|
|
20
|
+
(0, unplugin.setParseImpl)(ctx.parse);
|
|
21
|
+
return () => {
|
|
22
|
+
const log = require_logger.extendLog(ctx.log, name);
|
|
23
|
+
log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
|
|
24
|
+
try {
|
|
25
|
+
const { resolveId, load } = require_module_resolution.createUnpluginModuleResolutionFunctions(context);
|
|
26
|
+
return {
|
|
27
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
|
|
28
|
+
api: ctx.$$internal.api,
|
|
29
|
+
resolveId: {
|
|
30
|
+
filter: { id: { include: [/.*/] } },
|
|
31
|
+
handler: resolveId
|
|
32
|
+
},
|
|
33
|
+
load: {
|
|
34
|
+
filter: { id: { include: [/.*/] } },
|
|
35
|
+
handler: load
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.createUnpluginResolver = createUnpluginResolver;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { extendLog } from "../logger.mjs";
|
|
2
|
+
import "../utilities/source-file.mjs";
|
|
3
|
+
import "./helpers.mjs";
|
|
4
|
+
import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
|
|
5
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
6
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
import { setParseImpl } from "unplugin";
|
|
9
|
+
|
|
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 createUnpluginResolver(context, name = "unplugin") {
|
|
18
|
+
const ctx = context;
|
|
19
|
+
setParseImpl(ctx.parse);
|
|
20
|
+
return () => {
|
|
21
|
+
const log = extendLog(ctx.log, name);
|
|
22
|
+
log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
|
|
23
|
+
try {
|
|
24
|
+
const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
|
|
25
|
+
return {
|
|
26
|
+
name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
|
|
27
|
+
api: ctx.$$internal.api,
|
|
28
|
+
resolveId: {
|
|
29
|
+
filter: { id: { include: [/.*/] } },
|
|
30
|
+
handler: resolveId
|
|
31
|
+
},
|
|
32
|
+
load: {
|
|
33
|
+
filter: { id: { include: [/.*/] } },
|
|
34
|
+
handler: load
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
} catch (error) {
|
|
38
|
+
log(LogLevelLabel.FATAL, error?.message);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createUnpluginResolver };
|