@powerlines/plugin-style-dictionary 0.3.132 → 0.3.133
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/index.cjs +8 -8
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.mts +49 -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/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/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 +6 -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/api.d.cts +104 -0
- package/dist/powerlines/src/types/api.d.mts +104 -0
- package/dist/powerlines/src/types/babel.d.mts +2 -0
- package/dist/powerlines/src/types/build.cjs +21 -0
- package/dist/powerlines/src/types/build.d.cts +185 -0
- package/dist/powerlines/src/types/build.d.mts +185 -0
- package/dist/powerlines/src/types/build.mjs +21 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +424 -0
- package/dist/powerlines/src/types/config.d.mts +424 -0
- package/dist/powerlines/src/types/context.d.cts +514 -0
- package/dist/powerlines/src/types/context.d.mts +514 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.cts +32 -0
- package/dist/powerlines/src/types/hooks.d.mts +32 -0
- package/dist/powerlines/src/types/plugin.d.cts +205 -0
- package/dist/powerlines/src/types/plugin.d.mts +205 -0
- package/dist/powerlines/src/types/resolved.d.cts +93 -0
- package/dist/powerlines/src/types/resolved.d.mts +93 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/powerlines/src/types/unplugin.d.mts +23 -0
- package/dist/types/plugin.d.cts +3 -3
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_resolve = require('./powerlines/src/lib/utilities/resolve.cjs');
|
|
3
4
|
const require_file_header = require('./style-dictionary/file-header.cjs');
|
|
4
5
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
6
|
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
6
7
|
let defu = require("defu");
|
|
7
8
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
8
|
-
let powerlines_lib_utilities_resolve = require("powerlines/lib/utilities/resolve");
|
|
9
9
|
let style_dictionary = require("style-dictionary");
|
|
10
10
|
style_dictionary = require_rolldown_runtime.__toESM(style_dictionary);
|
|
11
11
|
|
|
@@ -31,7 +31,7 @@ const plugin = (options = {}) => {
|
|
|
31
31
|
if (this.config.styleDictionary.customActions) {
|
|
32
32
|
let builder;
|
|
33
33
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customActions)) builder = this.config.styleDictionary.customActions;
|
|
34
|
-
else builder = await
|
|
34
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customActions);
|
|
35
35
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, action]) => {
|
|
36
36
|
this.styleDictionary.registerAction({
|
|
37
37
|
...action,
|
|
@@ -42,7 +42,7 @@ const plugin = (options = {}) => {
|
|
|
42
42
|
if (this.config.styleDictionary.customFileHeaders) {
|
|
43
43
|
let builder;
|
|
44
44
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFileHeaders)) builder = this.config.styleDictionary.customFileHeaders;
|
|
45
|
-
else builder = await
|
|
45
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFileHeaders);
|
|
46
46
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, fileHeader$1]) => {
|
|
47
47
|
this.styleDictionary.registerFileHeader({
|
|
48
48
|
name,
|
|
@@ -53,7 +53,7 @@ const plugin = (options = {}) => {
|
|
|
53
53
|
if (this.config.styleDictionary.customFilters) {
|
|
54
54
|
let builder;
|
|
55
55
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFilters)) builder = this.config.styleDictionary.customFilters;
|
|
56
|
-
else builder = await
|
|
56
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFilters);
|
|
57
57
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, filter]) => {
|
|
58
58
|
this.styleDictionary.registerFilter({
|
|
59
59
|
...filter,
|
|
@@ -64,7 +64,7 @@ const plugin = (options = {}) => {
|
|
|
64
64
|
if (this.config.styleDictionary.customPreprocessors) {
|
|
65
65
|
let builder;
|
|
66
66
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customPreprocessors)) builder = this.config.styleDictionary.customPreprocessors;
|
|
67
|
-
else builder = await
|
|
67
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customPreprocessors);
|
|
68
68
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, preprocessor]) => {
|
|
69
69
|
this.styleDictionary.registerPreprocessor({
|
|
70
70
|
...preprocessor,
|
|
@@ -75,7 +75,7 @@ const plugin = (options = {}) => {
|
|
|
75
75
|
if (this.config.styleDictionary.customParsers) {
|
|
76
76
|
let builder;
|
|
77
77
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customParsers)) builder = this.config.styleDictionary.customParsers;
|
|
78
|
-
else builder = await
|
|
78
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customParsers);
|
|
79
79
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, parser]) => {
|
|
80
80
|
this.styleDictionary.registerParser({
|
|
81
81
|
...parser,
|
|
@@ -86,7 +86,7 @@ const plugin = (options = {}) => {
|
|
|
86
86
|
if (this.config.styleDictionary.customTransforms) {
|
|
87
87
|
let builder;
|
|
88
88
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransforms)) builder = this.config.styleDictionary.customTransforms;
|
|
89
|
-
else builder = await
|
|
89
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransforms);
|
|
90
90
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transform]) => {
|
|
91
91
|
this.styleDictionary.registerTransform({
|
|
92
92
|
...transform,
|
|
@@ -97,7 +97,7 @@ const plugin = (options = {}) => {
|
|
|
97
97
|
if (this.config.styleDictionary.customTransformGroups) {
|
|
98
98
|
let builder;
|
|
99
99
|
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransformGroups)) builder = this.config.styleDictionary.customTransformGroups;
|
|
100
|
-
else builder = await
|
|
100
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransformGroups);
|
|
101
101
|
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transformGroup]) => {
|
|
102
102
|
this.styleDictionary.registerTransformGroup({
|
|
103
103
|
name,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
1
2
|
import { CustomActionsBuilder, CustomFileHeadersBuilder, CustomFiltersBuilder, CustomFormatsBuilder, CustomParsersBuilder, CustomPreprocessorsBuilder, CustomTransformGroupsBuilder, CustomTransformsBuilder, StyleDictionaryPluginContext, StyleDictionaryPluginEnvironmentConfig, StyleDictionaryPluginOptions, StyleDictionaryPluginResolvedConfig, StyleDictionaryPluginUserConfig, __ΩCustomActionsBuilder, __ΩCustomFileHeadersBuilder, __ΩCustomFiltersBuilder, __ΩCustomFormatsBuilder, __ΩCustomParsersBuilder, __ΩCustomPreprocessorsBuilder, __ΩCustomTransformGroupsBuilder, __ΩCustomTransformsBuilder, __ΩStyleDictionaryPluginContext, __ΩStyleDictionaryPluginEnvironmentConfig, __ΩStyleDictionaryPluginOptions, __ΩStyleDictionaryPluginResolvedConfig, __ΩStyleDictionaryPluginUserConfig } from "./types/plugin.cjs";
|
|
2
|
-
import "./types/index.cjs";
|
|
3
|
-
import { Plugin } from "powerlines/types/plugin";
|
|
4
3
|
|
|
5
4
|
//#region src/index.d.ts
|
|
6
5
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
1
2
|
import { CustomActionsBuilder, CustomFileHeadersBuilder, CustomFiltersBuilder, CustomFormatsBuilder, CustomParsersBuilder, CustomPreprocessorsBuilder, CustomTransformGroupsBuilder, CustomTransformsBuilder, StyleDictionaryPluginContext, StyleDictionaryPluginEnvironmentConfig, StyleDictionaryPluginOptions, StyleDictionaryPluginResolvedConfig, StyleDictionaryPluginUserConfig, __ΩCustomActionsBuilder, __ΩCustomFileHeadersBuilder, __ΩCustomFiltersBuilder, __ΩCustomFormatsBuilder, __ΩCustomParsersBuilder, __ΩCustomPreprocessorsBuilder, __ΩCustomTransformGroupsBuilder, __ΩCustomTransformsBuilder, __ΩStyleDictionaryPluginContext, __ΩStyleDictionaryPluginEnvironmentConfig, __ΩStyleDictionaryPluginOptions, __ΩStyleDictionaryPluginResolvedConfig, __ΩStyleDictionaryPluginUserConfig } from "./types/plugin.mjs";
|
|
2
3
|
import "./types/index.mjs";
|
|
3
|
-
import { Plugin } from "powerlines/types/plugin";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { resolve } from "./powerlines/src/lib/utilities/resolve.mjs";
|
|
1
2
|
import { fileHeader } from "./style-dictionary/file-header.mjs";
|
|
2
3
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
4
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
4
5
|
import defu from "defu";
|
|
5
|
-
import { resolve } from "powerlines/lib/utilities/resolve";
|
|
6
6
|
import StyleDictionary from "style-dictionary";
|
|
7
7
|
|
|
8
8
|
//#region src/index.ts
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SelectHooksOptions } from "../../types/context.cjs";
|
|
2
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
5
|
+
type CallHookOptions = SelectHooksOptions & (({
|
|
6
|
+
/**
|
|
7
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue true
|
|
10
|
+
*/
|
|
11
|
+
sequential?: true;
|
|
12
|
+
} & ({
|
|
13
|
+
/**
|
|
14
|
+
* How to handle multiple return values from hooks.
|
|
15
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
16
|
+
* - "first": Return the first non-undefined value.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Merging only works if the return values are objects.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue "merge"
|
|
22
|
+
*/
|
|
23
|
+
result: "first";
|
|
24
|
+
} | {
|
|
25
|
+
/**
|
|
26
|
+
* How to handle multiple return values from hooks.
|
|
27
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
28
|
+
* - "first": Return the first non-undefined value.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Merging only works if the return values are objects.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue "merge"
|
|
34
|
+
*/
|
|
35
|
+
result?: "merge" | "last";
|
|
36
|
+
/**
|
|
37
|
+
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
38
|
+
*/
|
|
39
|
+
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
40
|
+
})) | {
|
|
41
|
+
/**
|
|
42
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
43
|
+
*/
|
|
44
|
+
sequential: false;
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { CallHookOptions };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "../../types/hooks.mjs";
|
|
2
|
+
import "../../types/resolved.mjs";
|
|
3
|
+
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
4
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
7
|
+
type CallHookOptions = SelectHooksOptions & (({
|
|
8
|
+
/**
|
|
9
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue true
|
|
12
|
+
*/
|
|
13
|
+
sequential?: true;
|
|
14
|
+
} & ({
|
|
15
|
+
/**
|
|
16
|
+
* How to handle multiple return values from hooks.
|
|
17
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
18
|
+
* - "first": Return the first non-undefined value.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Merging only works if the return values are objects.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue "merge"
|
|
24
|
+
*/
|
|
25
|
+
result: "first";
|
|
26
|
+
} | {
|
|
27
|
+
/**
|
|
28
|
+
* How to handle multiple return values from hooks.
|
|
29
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
30
|
+
* - "first": Return the first non-undefined value.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Merging only works if the return values are objects.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue "merge"
|
|
36
|
+
*/
|
|
37
|
+
result?: "merge" | "last";
|
|
38
|
+
/**
|
|
39
|
+
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
40
|
+
*/
|
|
41
|
+
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
42
|
+
})) | {
|
|
43
|
+
/**
|
|
44
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
45
|
+
*/
|
|
46
|
+
sequential: false;
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { CallHookOptions };
|
|
@@ -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_helpers_omit = require("@stryke/helpers/omit");
|
|
6
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
7
|
+
require("@stryke/path/replace");
|
|
8
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
|
+
require("@stryke/type-checks/is-string");
|
|
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 { omit } from "@stryke/helpers/omit";
|
|
4
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
|
+
import "@stryke/path/replace";
|
|
6
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
7
|
+
import "@stryke/type-checks/is-string";
|
|
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_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
3
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
4
|
+
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
|
+
require("@stryke/path/replace");
|
|
6
|
+
require("@stryke/type-checks/is-string");
|
|
7
|
+
require("@stryke/convert/to-array");
|
|
8
|
+
require("@stryke/hash/murmurhash");
|
|
9
|
+
require("@stryke/helpers/get-unique");
|
|
10
|
+
require("@stryke/path/append");
|
|
11
|
+
require("@stryke/path/is-type");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../plugin-utils/paths.mjs";
|
|
2
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
5
|
+
import "@stryke/path/replace";
|
|
6
|
+
import "@stryke/type-checks/is-string";
|
|
7
|
+
import "@stryke/convert/to-array";
|
|
8
|
+
import "@stryke/hash/murmurhash";
|
|
9
|
+
import "@stryke/helpers/get-unique";
|
|
10
|
+
import "@stryke/path/append";
|
|
11
|
+
import "@stryke/path/is-type";
|
|
12
|
+
|
|
13
|
+
export { };
|
|
@@ -0,0 +1,41 @@
|
|
|
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_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
4
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
5
|
+
require("@storm-software/config-tools/logger");
|
|
6
|
+
require("@storm-software/config-tools/utilities/colors");
|
|
7
|
+
require("@stryke/helpers/noop");
|
|
8
|
+
let chalk = require("chalk");
|
|
9
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
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 { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
2
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
3
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
4
|
+
import "@storm-software/config-tools/logger";
|
|
5
|
+
import "@storm-software/config-tools/utilities/colors";
|
|
6
|
+
import "@stryke/helpers/noop";
|
|
7
|
+
import chalk from "chalk";
|
|
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,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 };
|