@powerlines/plugin-style-dictionary 0.3.18 → 0.3.20
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/index.cjs +124 -1
- package/dist/index.mjs +119 -1
- package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
- package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
- package/dist/powerlines/src/lib/entry.cjs +12 -1
- package/dist/powerlines/src/lib/entry.mjs +14 -1
- package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
- package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
- package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
- package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/style-dictionary/file-header.cjs +15 -1
- package/dist/style-dictionary/file-header.mjs +14 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +8 -8
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,124 @@
|
|
|
1
|
-
Object.defineProperty(exports
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_resolve = require('./powerlines/src/lib/utilities/resolve.cjs');
|
|
4
|
+
const require_file_header = require('./style-dictionary/file-header.cjs');
|
|
5
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
6
|
+
let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
7
|
+
let defu = require("defu");
|
|
8
|
+
defu = require_rolldown_runtime.__toESM(defu);
|
|
9
|
+
let style_dictionary = require("style-dictionary");
|
|
10
|
+
style_dictionary = require_rolldown_runtime.__toESM(style_dictionary);
|
|
11
|
+
|
|
12
|
+
//#region src/index.ts
|
|
13
|
+
/**
|
|
14
|
+
* A Powerlines plugin to integrate style-dictionary for code generation.
|
|
15
|
+
*
|
|
16
|
+
* @param options - The plugin options.
|
|
17
|
+
* @returns A Powerlines plugin instance.
|
|
18
|
+
*/
|
|
19
|
+
const plugin = (options = {}) => {
|
|
20
|
+
return {
|
|
21
|
+
name: "style-dictionary",
|
|
22
|
+
config() {
|
|
23
|
+
return { styleDictionary: (0, defu.default)(options, {
|
|
24
|
+
log: { verbosity: this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.DEBUG || this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.TRACE ? "verbose" : this.config.logLevel === null ? "silent" : void 0 },
|
|
25
|
+
fileHeader: "powerlines/file-header"
|
|
26
|
+
}) };
|
|
27
|
+
},
|
|
28
|
+
async configResolved() {
|
|
29
|
+
this.styleDictionary = this.config.styleDictionary.instance ?? new style_dictionary.default(this.config.styleDictionary);
|
|
30
|
+
this.styleDictionary.registerFileHeader(require_file_header.fileHeader(this));
|
|
31
|
+
if (this.config.styleDictionary.customActions) {
|
|
32
|
+
let builder;
|
|
33
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customActions)) builder = this.config.styleDictionary.customActions;
|
|
34
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customActions);
|
|
35
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, action]) => {
|
|
36
|
+
this.styleDictionary.registerAction({
|
|
37
|
+
...action,
|
|
38
|
+
name
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (this.config.styleDictionary.customFileHeaders) {
|
|
43
|
+
let builder;
|
|
44
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFileHeaders)) builder = this.config.styleDictionary.customFileHeaders;
|
|
45
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFileHeaders);
|
|
46
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, fileHeader$1]) => {
|
|
47
|
+
this.styleDictionary.registerFileHeader({
|
|
48
|
+
name,
|
|
49
|
+
fileHeader: fileHeader$1
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (this.config.styleDictionary.customFilters) {
|
|
54
|
+
let builder;
|
|
55
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFilters)) builder = this.config.styleDictionary.customFilters;
|
|
56
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customFilters);
|
|
57
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, filter]) => {
|
|
58
|
+
this.styleDictionary.registerFilter({
|
|
59
|
+
...filter,
|
|
60
|
+
name
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (this.config.styleDictionary.customPreprocessors) {
|
|
65
|
+
let builder;
|
|
66
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customPreprocessors)) builder = this.config.styleDictionary.customPreprocessors;
|
|
67
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customPreprocessors);
|
|
68
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, preprocessor]) => {
|
|
69
|
+
this.styleDictionary.registerPreprocessor({
|
|
70
|
+
...preprocessor,
|
|
71
|
+
name
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (this.config.styleDictionary.customParsers) {
|
|
76
|
+
let builder;
|
|
77
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customParsers)) builder = this.config.styleDictionary.customParsers;
|
|
78
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customParsers);
|
|
79
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, parser]) => {
|
|
80
|
+
this.styleDictionary.registerParser({
|
|
81
|
+
...parser,
|
|
82
|
+
name
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (this.config.styleDictionary.customTransforms) {
|
|
87
|
+
let builder;
|
|
88
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransforms)) builder = this.config.styleDictionary.customTransforms;
|
|
89
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransforms);
|
|
90
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transform]) => {
|
|
91
|
+
this.styleDictionary.registerTransform({
|
|
92
|
+
...transform,
|
|
93
|
+
name
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (this.config.styleDictionary.customTransformGroups) {
|
|
98
|
+
let builder;
|
|
99
|
+
if ((0, __stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransformGroups)) builder = this.config.styleDictionary.customTransformGroups;
|
|
100
|
+
else builder = await require_resolve.resolve(this, this.config.styleDictionary.customTransformGroups);
|
|
101
|
+
Object.entries((0, __stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transformGroup]) => {
|
|
102
|
+
this.styleDictionary.registerTransformGroup({
|
|
103
|
+
name,
|
|
104
|
+
transforms: transformGroup
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
async clean() {
|
|
110
|
+
await this.styleDictionary.cleanAllPlatforms({ cache: !this.config.skipCache });
|
|
111
|
+
},
|
|
112
|
+
prepare: {
|
|
113
|
+
order: "pre",
|
|
114
|
+
async handler() {
|
|
115
|
+
await this.styleDictionary.buildAllPlatforms({ cache: !this.config.skipCache });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
var src_default = plugin;
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
exports.default = src_default;
|
|
124
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,119 @@
|
|
|
1
|
-
import{resolve
|
|
1
|
+
import { resolve } from "./powerlines/src/lib/utilities/resolve.mjs";
|
|
2
|
+
import { fileHeader } from "./style-dictionary/file-header.mjs";
|
|
3
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
4
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
5
|
+
import defu from "defu";
|
|
6
|
+
import StyleDictionary from "style-dictionary";
|
|
7
|
+
|
|
8
|
+
//#region src/index.ts
|
|
9
|
+
/**
|
|
10
|
+
* A Powerlines plugin to integrate style-dictionary for code generation.
|
|
11
|
+
*
|
|
12
|
+
* @param options - The plugin options.
|
|
13
|
+
* @returns A Powerlines plugin instance.
|
|
14
|
+
*/
|
|
15
|
+
const plugin = (options = {}) => {
|
|
16
|
+
return {
|
|
17
|
+
name: "style-dictionary",
|
|
18
|
+
config() {
|
|
19
|
+
return { styleDictionary: defu(options, {
|
|
20
|
+
log: { verbosity: this.config.logLevel === LogLevelLabel.DEBUG || this.config.logLevel === LogLevelLabel.TRACE ? "verbose" : this.config.logLevel === null ? "silent" : void 0 },
|
|
21
|
+
fileHeader: "powerlines/file-header"
|
|
22
|
+
}) };
|
|
23
|
+
},
|
|
24
|
+
async configResolved() {
|
|
25
|
+
this.styleDictionary = this.config.styleDictionary.instance ?? new StyleDictionary(this.config.styleDictionary);
|
|
26
|
+
this.styleDictionary.registerFileHeader(fileHeader(this));
|
|
27
|
+
if (this.config.styleDictionary.customActions) {
|
|
28
|
+
let builder;
|
|
29
|
+
if (isFunction(this.config.styleDictionary.customActions)) builder = this.config.styleDictionary.customActions;
|
|
30
|
+
else builder = await resolve(this, this.config.styleDictionary.customActions);
|
|
31
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, action]) => {
|
|
32
|
+
this.styleDictionary.registerAction({
|
|
33
|
+
...action,
|
|
34
|
+
name
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (this.config.styleDictionary.customFileHeaders) {
|
|
39
|
+
let builder;
|
|
40
|
+
if (isFunction(this.config.styleDictionary.customFileHeaders)) builder = this.config.styleDictionary.customFileHeaders;
|
|
41
|
+
else builder = await resolve(this, this.config.styleDictionary.customFileHeaders);
|
|
42
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, fileHeader$1]) => {
|
|
43
|
+
this.styleDictionary.registerFileHeader({
|
|
44
|
+
name,
|
|
45
|
+
fileHeader: fileHeader$1
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (this.config.styleDictionary.customFilters) {
|
|
50
|
+
let builder;
|
|
51
|
+
if (isFunction(this.config.styleDictionary.customFilters)) builder = this.config.styleDictionary.customFilters;
|
|
52
|
+
else builder = await resolve(this, this.config.styleDictionary.customFilters);
|
|
53
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, filter]) => {
|
|
54
|
+
this.styleDictionary.registerFilter({
|
|
55
|
+
...filter,
|
|
56
|
+
name
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (this.config.styleDictionary.customPreprocessors) {
|
|
61
|
+
let builder;
|
|
62
|
+
if (isFunction(this.config.styleDictionary.customPreprocessors)) builder = this.config.styleDictionary.customPreprocessors;
|
|
63
|
+
else builder = await resolve(this, this.config.styleDictionary.customPreprocessors);
|
|
64
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, preprocessor]) => {
|
|
65
|
+
this.styleDictionary.registerPreprocessor({
|
|
66
|
+
...preprocessor,
|
|
67
|
+
name
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (this.config.styleDictionary.customParsers) {
|
|
72
|
+
let builder;
|
|
73
|
+
if (isFunction(this.config.styleDictionary.customParsers)) builder = this.config.styleDictionary.customParsers;
|
|
74
|
+
else builder = await resolve(this, this.config.styleDictionary.customParsers);
|
|
75
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, parser]) => {
|
|
76
|
+
this.styleDictionary.registerParser({
|
|
77
|
+
...parser,
|
|
78
|
+
name
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (this.config.styleDictionary.customTransforms) {
|
|
83
|
+
let builder;
|
|
84
|
+
if (isFunction(this.config.styleDictionary.customTransforms)) builder = this.config.styleDictionary.customTransforms;
|
|
85
|
+
else builder = await resolve(this, this.config.styleDictionary.customTransforms);
|
|
86
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, transform]) => {
|
|
87
|
+
this.styleDictionary.registerTransform({
|
|
88
|
+
...transform,
|
|
89
|
+
name
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (this.config.styleDictionary.customTransformGroups) {
|
|
94
|
+
let builder;
|
|
95
|
+
if (isFunction(this.config.styleDictionary.customTransformGroups)) builder = this.config.styleDictionary.customTransformGroups;
|
|
96
|
+
else builder = await resolve(this, this.config.styleDictionary.customTransformGroups);
|
|
97
|
+
Object.entries(isFunction(builder) ? builder(this) : builder).forEach(([name, transformGroup]) => {
|
|
98
|
+
this.styleDictionary.registerTransformGroup({
|
|
99
|
+
name,
|
|
100
|
+
transforms: transformGroup
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
async clean() {
|
|
106
|
+
await this.styleDictionary.cleanAllPlatforms({ cache: !this.config.skipCache });
|
|
107
|
+
},
|
|
108
|
+
prepare: {
|
|
109
|
+
order: "pre",
|
|
110
|
+
async handler() {
|
|
111
|
+
await this.styleDictionary.buildAllPlatforms({ cache: !this.config.skipCache });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
var src_default = plugin;
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { src_default as default, plugin };
|
|
@@ -1,14 +1,102 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.builtins.reduce((ret, id) => {
|
|
58
|
+
if (!ret[id]) {
|
|
59
|
+
const path = context.fs.ids[id];
|
|
60
|
+
if (path) ret[id] = path;
|
|
61
|
+
}
|
|
62
|
+
return ret;
|
|
63
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
64
|
+
if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
|
|
65
|
+
return ret;
|
|
66
|
+
}, {}) : context.config.build.alias : {}),
|
|
67
|
+
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
|
|
68
|
+
}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
|
|
69
|
+
"alias",
|
|
70
|
+
"inject",
|
|
71
|
+
"external",
|
|
72
|
+
"noExternal",
|
|
73
|
+
"skipNodeModulesBundle",
|
|
74
|
+
"extensions"
|
|
75
|
+
]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
|
|
76
|
+
"alias",
|
|
77
|
+
"inject",
|
|
78
|
+
"external",
|
|
79
|
+
"noExternal",
|
|
80
|
+
"skipNodeModulesBundle",
|
|
81
|
+
"extensions",
|
|
82
|
+
"variant",
|
|
83
|
+
"override"
|
|
84
|
+
]) : {}, {
|
|
85
|
+
mainFields: context.config.build.mainFields,
|
|
86
|
+
conditions: context.config.build.conditions,
|
|
87
|
+
define: context.config.build.define,
|
|
88
|
+
resolveExtensions: context.config.build.extensions,
|
|
89
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
90
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
91
|
+
platform: context.config.build.platform,
|
|
92
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
93
|
+
outdir: context.config.output.buildPath,
|
|
94
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
95
|
+
minify: context.config.mode !== "development",
|
|
96
|
+
metafile: context.config.mode === "development",
|
|
97
|
+
sourcemap: context.config.mode === "development"
|
|
98
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
exports.extractESBuildConfig = extractESBuildConfig;
|
|
@@ -1,14 +1,100 @@
|
|
|
1
|
-
import"../entry.mjs";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.builtins.reduce((ret, id) => {
|
|
56
|
+
if (!ret[id]) {
|
|
57
|
+
const path = context.fs.ids[id];
|
|
58
|
+
if (path) ret[id] = path;
|
|
59
|
+
}
|
|
60
|
+
return ret;
|
|
61
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
62
|
+
if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
|
|
63
|
+
return ret;
|
|
64
|
+
}, {}) : context.config.build.alias : {}),
|
|
65
|
+
inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
|
|
66
|
+
}, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
|
|
67
|
+
"alias",
|
|
68
|
+
"inject",
|
|
69
|
+
"external",
|
|
70
|
+
"noExternal",
|
|
71
|
+
"skipNodeModulesBundle",
|
|
72
|
+
"extensions"
|
|
73
|
+
]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
|
|
74
|
+
"alias",
|
|
75
|
+
"inject",
|
|
76
|
+
"external",
|
|
77
|
+
"noExternal",
|
|
78
|
+
"skipNodeModulesBundle",
|
|
79
|
+
"extensions",
|
|
80
|
+
"variant",
|
|
81
|
+
"override"
|
|
82
|
+
]) : {}, {
|
|
83
|
+
mainFields: context.config.build.mainFields,
|
|
84
|
+
conditions: context.config.build.conditions,
|
|
85
|
+
define: context.config.build.define,
|
|
86
|
+
resolveExtensions: context.config.build.extensions,
|
|
87
|
+
packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
|
|
88
|
+
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
89
|
+
platform: context.config.build.platform,
|
|
90
|
+
treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
|
|
91
|
+
outdir: context.config.output.buildPath,
|
|
92
|
+
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
93
|
+
minify: context.config.mode !== "development",
|
|
94
|
+
metafile: context.config.mode === "development",
|
|
95
|
+
sourcemap: context.config.mode === "development"
|
|
96
|
+
}, DEFAULT_ESBUILD_CONFIG);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { extractESBuildConfig };
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
require(
|
|
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/fs/is-file");
|
|
9
|
+
require("@stryke/fs/list-files");
|
|
10
|
+
require("@stryke/hash/murmurhash");
|
|
11
|
+
require("@stryke/helpers/get-unique");
|
|
12
|
+
require("@stryke/path/append");
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import"../plugin-utils/paths.mjs";
|
|
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/fs/is-file";
|
|
9
|
+
import "@stryke/fs/list-files";
|
|
10
|
+
import "@stryke/hash/murmurhash";
|
|
11
|
+
import "@stryke/helpers/get-unique";
|
|
12
|
+
import "@stryke/path/append";
|
|
13
|
+
|
|
14
|
+
export { };
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_esbuild = require('../build/esbuild.cjs');
|
|
3
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
4
|
+
let esbuild = require("esbuild");
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
7
|
+
/**
|
|
8
|
+
* Bundle a type definition to a module.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The context object containing the environment paths.
|
|
11
|
+
* @param file - The file path to bundle.
|
|
12
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
+
* @returns A promise that resolves to the bundled module.
|
|
14
|
+
*/
|
|
15
|
+
async function bundle(context, file, overrides = {}) {
|
|
16
|
+
const path = await context.fs.resolve(file);
|
|
17
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
18
|
+
const result = await (0, esbuild.build)({
|
|
19
|
+
...require_esbuild.extractESBuildConfig(context),
|
|
20
|
+
entryPoints: [path],
|
|
21
|
+
write: false,
|
|
22
|
+
sourcemap: false,
|
|
23
|
+
splitting: false,
|
|
24
|
+
treeShaking: false,
|
|
25
|
+
bundle: true,
|
|
26
|
+
...overrides
|
|
27
|
+
});
|
|
28
|
+
if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
29
|
+
if (result.warnings.length > 0) context.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
30
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
31
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.bundle = bundle;
|
|
@@ -1 +1,34 @@
|
|
|
1
|
-
import{extractESBuildConfig
|
|
1
|
+
import { extractESBuildConfig } from "../build/esbuild.mjs";
|
|
2
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
+
import { build } from "esbuild";
|
|
4
|
+
|
|
5
|
+
//#region ../powerlines/src/lib/utilities/bundle.ts
|
|
6
|
+
/**
|
|
7
|
+
* Bundle a type definition to a module.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context object containing the environment paths.
|
|
10
|
+
* @param file - The file path to bundle.
|
|
11
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
+
* @returns A promise that resolves to the bundled module.
|
|
13
|
+
*/
|
|
14
|
+
async function bundle(context, file, overrides = {}) {
|
|
15
|
+
const path = await context.fs.resolve(file);
|
|
16
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
17
|
+
const result = await build({
|
|
18
|
+
...extractESBuildConfig(context),
|
|
19
|
+
entryPoints: [path],
|
|
20
|
+
write: false,
|
|
21
|
+
sourcemap: false,
|
|
22
|
+
splitting: false,
|
|
23
|
+
treeShaking: false,
|
|
24
|
+
bundle: true,
|
|
25
|
+
...overrides
|
|
26
|
+
});
|
|
27
|
+
if (result.errors.length > 0) throw new Error(`Failed to transpile ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
28
|
+
if (result.warnings.length > 0) context.log(LogLevelLabel.WARN, `Warnings while transpiling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
29
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
30
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { bundle };
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_bundle = require('./bundle.cjs');
|
|
3
|
+
let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
4
|
+
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
|
+
|
|
6
|
+
//#region ../powerlines/src/lib/utilities/resolve.ts
|
|
7
|
+
/**
|
|
8
|
+
* Compiles a type definition to a module.
|
|
9
|
+
*
|
|
10
|
+
* @param context - The context object containing the environment paths.
|
|
11
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
12
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
13
|
+
* @returns A promise that resolves to the compiled module.
|
|
14
|
+
*/
|
|
15
|
+
async function resolve(context, type, overrides = {}) {
|
|
16
|
+
let typeDefinition;
|
|
17
|
+
if ((0, __stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(type);
|
|
18
|
+
else typeDefinition = type;
|
|
19
|
+
const result = await require_bundle.bundle(context, typeDefinition.file, overrides);
|
|
20
|
+
const resolved = await context.resolver.evalModule(result.text, {
|
|
21
|
+
filename: result.path,
|
|
22
|
+
forceTranspile: true
|
|
23
|
+
});
|
|
24
|
+
let exportName = typeDefinition.name;
|
|
25
|
+
if (!exportName) exportName = "default";
|
|
26
|
+
return resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.resolve = resolve;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
import{bundle
|
|
1
|
+
import { bundle } from "./bundle.mjs";
|
|
2
|
+
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
3
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
+
|
|
5
|
+
//#region ../powerlines/src/lib/utilities/resolve.ts
|
|
6
|
+
/**
|
|
7
|
+
* Compiles a type definition to a module.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context object containing the environment paths.
|
|
10
|
+
* @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
|
|
11
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
+
* @returns A promise that resolves to the compiled module.
|
|
13
|
+
*/
|
|
14
|
+
async function resolve(context, type, overrides = {}) {
|
|
15
|
+
let typeDefinition;
|
|
16
|
+
if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
|
|
17
|
+
else typeDefinition = type;
|
|
18
|
+
const result = await bundle(context, typeDefinition.file, overrides);
|
|
19
|
+
const resolved = await context.resolver.evalModule(result.text, {
|
|
20
|
+
filename: result.path,
|
|
21
|
+
forceTranspile: true
|
|
22
|
+
});
|
|
23
|
+
let exportName = typeDefinition.name;
|
|
24
|
+
if (!exportName) exportName = "default";
|
|
25
|
+
return resolved[exportName] ?? resolved[`__Ω${exportName}`];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { resolve };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(
|
|
1
|
+
require("@stryke/path/replace");
|
|
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
78
78
|
*/
|
|
79
79
|
allowReturnOutsideFunction?: boolean;
|
|
80
80
|
}
|
|
81
|
+
interface EmitOptions extends WriteOptions {
|
|
82
|
+
/**
|
|
83
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
84
|
+
*/
|
|
85
|
+
emitWithBundler?: boolean;
|
|
86
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
87
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
88
|
+
}
|
|
81
89
|
/**
|
|
82
90
|
* Options for emitting entry virtual files
|
|
83
91
|
*/
|
|
84
|
-
type EmitEntryOptions =
|
|
92
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
85
93
|
/**
|
|
86
94
|
* The unresolved Powerlines context.
|
|
87
95
|
*
|
|
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
292
300
|
* The Powerlines builtin virtual files
|
|
293
301
|
*/
|
|
294
302
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
305
|
+
*
|
|
306
|
+
* @param code - The source code of the file
|
|
307
|
+
* @param path - The path to write the file to
|
|
308
|
+
* @param options - Additional options for writing the file
|
|
309
|
+
*/
|
|
310
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
313
|
+
*
|
|
314
|
+
* @param code - The source code of the file
|
|
315
|
+
* @param path - The path to write the file to
|
|
316
|
+
* @param options - Additional options for writing the file
|
|
317
|
+
*/
|
|
318
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
295
319
|
/**
|
|
296
320
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
297
321
|
*
|
|
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
300
324
|
* @param path - An optional path to write the builtin file to
|
|
301
325
|
* @param options - Additional options for writing the builtin file
|
|
302
326
|
*/
|
|
303
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
327
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
304
328
|
/**
|
|
305
329
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
306
330
|
*
|
|
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
309
333
|
* @param path - An optional path to write the builtin file to
|
|
310
334
|
* @param options - Additional options for writing the builtin file
|
|
311
335
|
*/
|
|
312
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
336
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
313
337
|
/**
|
|
314
338
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
315
339
|
*
|
|
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
allowReturnOutsideFunction?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface EmitOptions extends WriteOptions {
|
|
84
|
+
/**
|
|
85
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
86
|
+
*/
|
|
87
|
+
emitWithBundler?: boolean;
|
|
88
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
89
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
90
|
+
}
|
|
83
91
|
/**
|
|
84
92
|
* Options for emitting entry virtual files
|
|
85
93
|
*/
|
|
86
|
-
type EmitEntryOptions =
|
|
94
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
87
95
|
/**
|
|
88
96
|
* The unresolved Powerlines context.
|
|
89
97
|
*
|
|
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
294
302
|
* The Powerlines builtin virtual files
|
|
295
303
|
*/
|
|
296
304
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
307
|
+
*
|
|
308
|
+
* @param code - The source code of the file
|
|
309
|
+
* @param path - The path to write the file to
|
|
310
|
+
* @param options - Additional options for writing the file
|
|
311
|
+
*/
|
|
312
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
315
|
+
*
|
|
316
|
+
* @param code - The source code of the file
|
|
317
|
+
* @param path - The path to write the file to
|
|
318
|
+
* @param options - Additional options for writing the file
|
|
319
|
+
*/
|
|
320
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
297
321
|
/**
|
|
298
322
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
299
323
|
*
|
|
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
302
326
|
* @param path - An optional path to write the builtin file to
|
|
303
327
|
* @param options - Additional options for writing the builtin file
|
|
304
328
|
*/
|
|
305
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
329
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
306
330
|
/**
|
|
307
331
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
308
332
|
*
|
|
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
311
335
|
* @param path - An optional path to write the builtin file to
|
|
312
336
|
* @param options - Additional options for writing the builtin file
|
|
313
337
|
*/
|
|
314
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
338
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
315
339
|
/**
|
|
316
340
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
317
341
|
*
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/style-dictionary/file-header.ts
|
|
3
|
+
const fileHeader = (context) => ({
|
|
4
|
+
name: "powerlines/file-header",
|
|
5
|
+
fileHeader: (defaultMessages = []) => {
|
|
6
|
+
return [
|
|
7
|
+
`Generated by ${context.config.framework || "Powerlines"}`,
|
|
8
|
+
"NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command",
|
|
9
|
+
...defaultMessages
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.fileHeader = fileHeader;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/style-dictionary/file-header.ts
|
|
2
|
+
const fileHeader = (context) => ({
|
|
3
|
+
name: "powerlines/file-header",
|
|
4
|
+
fileHeader: (defaultMessages = []) => {
|
|
5
|
+
return [
|
|
6
|
+
`Generated by ${context.config.framework || "Powerlines"}`,
|
|
7
|
+
"NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command",
|
|
8
|
+
...defaultMessages
|
|
9
|
+
];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { fileHeader };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-style-dictionary",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code with Style Dictionary.",
|
|
6
6
|
"repository": {
|
|
@@ -122,19 +122,19 @@
|
|
|
122
122
|
"powerlines-plugin"
|
|
123
123
|
],
|
|
124
124
|
"dependencies": {
|
|
125
|
-
"@stryke/path": "^0.24.
|
|
126
|
-
"@stryke/type-checks": "^0.5.
|
|
127
|
-
"@stryke/types": "^0.10.
|
|
125
|
+
"@stryke/path": "^0.24.1",
|
|
126
|
+
"@stryke/type-checks": "^0.5.15",
|
|
127
|
+
"@stryke/types": "^0.10.29",
|
|
128
128
|
"defu": "^6.1.4",
|
|
129
129
|
"jiti": "^2.6.1",
|
|
130
|
-
"powerlines": "^0.36.
|
|
130
|
+
"powerlines": "^0.36.24",
|
|
131
131
|
"style-dictionary": "^5.1.1"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
|
-
"@powerlines/nx": "^0.11.
|
|
135
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
134
|
+
"@powerlines/nx": "^0.11.50",
|
|
135
|
+
"@powerlines/plugin-plugin": "^0.12.71",
|
|
136
136
|
"@types/node": "^24.10.4"
|
|
137
137
|
},
|
|
138
138
|
"publishConfig": { "access": "public" },
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "4b695d4b3476fd9dd79521f92258d52dab2b8d72"
|
|
140
140
|
}
|