@powerlines/plugin-plugin 0.11.53 → 0.11.55
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/src/index.cjs +36 -1
- package/dist/src/index.js +36 -2
- package/dist/src/types/index.cjs +1 -0
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/plugin.cjs +5 -4
- package/dist/src/types/plugin.d.ts +18 -2
- package/dist/src/types/plugin.js +5 -5
- package/package.json +10 -9
- package/dist/config.d.ts +0 -23
package/dist/src/index.cjs
CHANGED
|
@@ -7,9 +7,12 @@ var alloyBabelPreset = require('@alloy-js/babel-preset');
|
|
|
7
7
|
var typescriptBabelPreset = require('@babel/preset-typescript');
|
|
8
8
|
var types = require('@storm-software/config-tools/types');
|
|
9
9
|
var tsup = require('@storm-software/tsup');
|
|
10
|
+
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
10
11
|
var stormJson = require('@stryke/json/storm-json');
|
|
11
12
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
12
13
|
var join = require('@stryke/path/join');
|
|
14
|
+
var titleCase = require('@stryke/string-format/title-case');
|
|
15
|
+
var isString = require('@stryke/type-checks/is-string');
|
|
13
16
|
var defu = require('defu');
|
|
14
17
|
var index = require('../node_modules/.pnpm/esbuild-plugin-babel@0.2.3_@babel_core@7.28.5/node_modules/esbuild-plugin-babel/src/index.cjs');
|
|
15
18
|
var tsup$1 = require('powerlines/lib/build/tsup');
|
|
@@ -31,7 +34,6 @@ const plugin = __assignType((options = {}) => {
|
|
|
31
34
|
type: "library",
|
|
32
35
|
entry: ["src/**/*.ts", "src/**/*.tsx"],
|
|
33
36
|
output: {
|
|
34
|
-
dts: false,
|
|
35
37
|
format: ["cjs", "esm"]
|
|
36
38
|
},
|
|
37
39
|
build: {
|
|
@@ -52,6 +54,38 @@ const plugin = __assignType((options = {}) => {
|
|
|
52
54
|
await this.fs.write(this.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
53
55
|
}
|
|
54
56
|
}, ['configResolved', 'P"/!']),
|
|
57
|
+
generateTypes: __assignType(async function generateTypes(code) {
|
|
58
|
+
if (!options.types?.userConfig) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let typeDef;
|
|
62
|
+
if (isString.isString(options.types.userConfig) &&
|
|
63
|
+
!options.types.userConfig.includes("#") &&
|
|
64
|
+
this.packageJson?.name) {
|
|
65
|
+
const pluginRoot = await this.resolve(this.packageJson.name);
|
|
66
|
+
if (pluginRoot &&
|
|
67
|
+
this.packageJson?.name &&
|
|
68
|
+
!(await this.resolve(options.types.userConfig, pluginRoot.id))) {
|
|
69
|
+
typeDef = {
|
|
70
|
+
file: this.packageJson.name,
|
|
71
|
+
name: options.types.userConfig
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!typeDef) {
|
|
76
|
+
typeDef = parseTypeDefinition.parseTypeDefinition(options.types.userConfig);
|
|
77
|
+
if (!typeDef) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return `${code}
|
|
82
|
+
|
|
83
|
+
// Extend \`UserConfig\` with the ${titleCase.titleCase(this.config.name)} plugin's type definition
|
|
84
|
+
declare module "powerlines" {
|
|
85
|
+
export interface UserConfig extends import("${typeDef.file}").${typeDef.name || "default"}
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
}, ['code', 'generateTypes', 'P&2!"/"']),
|
|
55
89
|
async build() {
|
|
56
90
|
await tsup.build(await tsup.resolveOptions(defu.defu({
|
|
57
91
|
config: false,
|
|
@@ -90,6 +124,7 @@ exports.__ΩPluginPluginAlloyOptions = src_types_plugin.__ΩPluginPluginAlloyOpt
|
|
|
90
124
|
exports.__ΩPluginPluginContext = src_types_plugin.__ΩPluginPluginContext;
|
|
91
125
|
exports.__ΩPluginPluginOptions = src_types_plugin.__ΩPluginPluginOptions;
|
|
92
126
|
exports.__ΩPluginPluginResolvedConfig = src_types_plugin.__ΩPluginPluginResolvedConfig;
|
|
127
|
+
exports.__ΩPluginPluginTypesOptions = src_types_plugin.__ΩPluginPluginTypesOptions;
|
|
93
128
|
exports.__ΩPluginPluginUserConfig = src_types_plugin.__ΩPluginPluginUserConfig;
|
|
94
129
|
exports.default = plugin;
|
|
95
130
|
exports.plugin = plugin;
|
package/dist/src/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { __ΩPluginPluginOptions as ___PluginPluginOptions } from './types/plugin.js';
|
|
2
|
-
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginResolvedConfig, __ΩPluginPluginUserConfig } from './types/plugin.js';
|
|
2
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig } from './types/plugin.js';
|
|
3
3
|
import alloyBabelPreset from '@alloy-js/babel-preset';
|
|
4
4
|
import typescriptBabelPreset from '@babel/preset-typescript';
|
|
5
5
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
6
6
|
import { build, resolveOptions } from '@storm-software/tsup';
|
|
7
|
+
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
7
8
|
import { StormJSON } from '@stryke/json/storm-json';
|
|
8
9
|
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
9
10
|
import { joinPaths } from '@stryke/path/join';
|
|
11
|
+
import { titleCase } from '@stryke/string-format/title-case';
|
|
12
|
+
import { isString } from '@stryke/type-checks/is-string';
|
|
10
13
|
import { defu } from 'defu';
|
|
11
14
|
import pluginBabel from '../node_modules/.pnpm/esbuild-plugin-babel@0.2.3_@babel_core@7.28.5/node_modules/esbuild-plugin-babel/src/index.js';
|
|
12
15
|
import { resolveTsupEntry, extractTsupConfig } from 'powerlines/lib/build/tsup';
|
|
@@ -28,7 +31,6 @@ const plugin = __assignType((options = {}) => {
|
|
|
28
31
|
type: "library",
|
|
29
32
|
entry: ["src/**/*.ts", "src/**/*.tsx"],
|
|
30
33
|
output: {
|
|
31
|
-
dts: false,
|
|
32
34
|
format: ["cjs", "esm"]
|
|
33
35
|
},
|
|
34
36
|
build: {
|
|
@@ -49,6 +51,38 @@ const plugin = __assignType((options = {}) => {
|
|
|
49
51
|
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
50
52
|
}
|
|
51
53
|
}, ['configResolved', 'P"/!']),
|
|
54
|
+
generateTypes: __assignType(async function generateTypes(code) {
|
|
55
|
+
if (!options.types?.userConfig) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let typeDef;
|
|
59
|
+
if (isString(options.types.userConfig) &&
|
|
60
|
+
!options.types.userConfig.includes("#") &&
|
|
61
|
+
this.packageJson?.name) {
|
|
62
|
+
const pluginRoot = await this.resolve(this.packageJson.name);
|
|
63
|
+
if (pluginRoot &&
|
|
64
|
+
this.packageJson?.name &&
|
|
65
|
+
!(await this.resolve(options.types.userConfig, pluginRoot.id))) {
|
|
66
|
+
typeDef = {
|
|
67
|
+
file: this.packageJson.name,
|
|
68
|
+
name: options.types.userConfig
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!typeDef) {
|
|
73
|
+
typeDef = parseTypeDefinition(options.types.userConfig);
|
|
74
|
+
if (!typeDef) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return `${code}
|
|
79
|
+
|
|
80
|
+
// Extend \`UserConfig\` with the ${titleCase(this.config.name)} plugin's type definition
|
|
81
|
+
declare module "powerlines" {
|
|
82
|
+
export interface UserConfig extends import("${typeDef.file}").${typeDef.name || "default"}
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
}, ['code', 'generateTypes', 'P&2!"/"']),
|
|
52
86
|
async build() {
|
|
53
87
|
await build(await resolveOptions(defu({
|
|
54
88
|
config: false,
|
package/dist/src/types/index.cjs
CHANGED
|
@@ -8,4 +8,5 @@ exports.__ΩPluginPluginAlloyOptions = src_types_plugin.__ΩPluginPluginAlloyOpt
|
|
|
8
8
|
exports.__ΩPluginPluginContext = src_types_plugin.__ΩPluginPluginContext;
|
|
9
9
|
exports.__ΩPluginPluginOptions = src_types_plugin.__ΩPluginPluginOptions;
|
|
10
10
|
exports.__ΩPluginPluginResolvedConfig = src_types_plugin.__ΩPluginPluginResolvedConfig;
|
|
11
|
+
exports.__ΩPluginPluginTypesOptions = src_types_plugin.__ΩPluginPluginTypesOptions;
|
|
11
12
|
exports.__ΩPluginPluginUserConfig = src_types_plugin.__ΩPluginPluginUserConfig;
|
package/dist/src/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginUserConfig } from './plugin.js';
|
|
1
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig } from './plugin.js';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const __ΩPartial = ['T', 'Partial', 'l+e#!e"!fRb!Pde"!gN#"w"y'];
|
|
4
|
-
const __ΩRequired = ['T', 'Required', 'l+e#!e"!fRb!Pde"!gN##w"y'];
|
|
5
4
|
const __ΩPluginPluginAlloyOptions = [() => __ΩPartial, 'PrintTreeOptions', 'generatesJson', true, 'generatesMarkdown', 'PluginPluginAlloyOptions', 'P"w"o!"P)4#8>$)4%8>$MKw&y'];
|
|
6
|
-
const __Ω
|
|
7
|
-
const __Ω
|
|
8
|
-
const __Ω
|
|
5
|
+
const __ΩPluginPluginTypesOptions = ['TypeDefinitionParameter', 'options', 'userConfig', 'PluginPluginTypesOptions', 'P"w!4"8"w!4#8Mw$y'];
|
|
6
|
+
const __ΩPluginPluginOptions = [() => __ΩPluginPluginAlloyOptions, 'alloy', false, () => __ΩPluginPluginTypesOptions, 'types', 'PluginPluginOptions', 'PPn!)J4"8>#n$4%8Mw&y'];
|
|
7
|
+
const __ΩPluginPluginUserConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginUserConfig', 'P!Pn!4"MKw#y'];
|
|
8
|
+
const __ΩPluginPluginResolvedConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginResolvedConfig', 'P!Pn!4"MKw#y'];
|
|
9
9
|
const __ΩPluginPluginContext = [() => __ΩPluginPluginResolvedConfig, 'TResolvedConfig', 'PluginPluginContext', 'n!c"!w#y'];
|
|
10
10
|
|
|
11
11
|
exports.__ΩPluginPluginAlloyOptions = __ΩPluginPluginAlloyOptions;
|
|
12
12
|
exports.__ΩPluginPluginContext = __ΩPluginPluginContext;
|
|
13
13
|
exports.__ΩPluginPluginOptions = __ΩPluginPluginOptions;
|
|
14
14
|
exports.__ΩPluginPluginResolvedConfig = __ΩPluginPluginResolvedConfig;
|
|
15
|
+
exports.__ΩPluginPluginTypesOptions = __ΩPluginPluginTypesOptions;
|
|
15
16
|
exports.__ΩPluginPluginUserConfig = __ΩPluginPluginUserConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrintTreeOptions } from "@alloy-js/core";
|
|
2
|
+
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
2
3
|
import type { TsupBuildConfig, TsupResolvedBuildConfig } from "powerlines/types/build";
|
|
3
4
|
import type { UserConfig } from "powerlines/types/config";
|
|
4
5
|
import type { PluginContext } from "powerlines/types/context";
|
|
@@ -17,6 +18,16 @@ export type PluginPluginAlloyOptions = Partial<PrintTreeOptions> & {
|
|
|
17
18
|
*/
|
|
18
19
|
generatesMarkdown?: boolean;
|
|
19
20
|
};
|
|
21
|
+
export interface PluginPluginTypesOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The type definition for the plugin's options.
|
|
24
|
+
*/
|
|
25
|
+
options?: TypeDefinitionParameter;
|
|
26
|
+
/**
|
|
27
|
+
* The type definition for the plugin's user config.
|
|
28
|
+
*/
|
|
29
|
+
userConfig?: TypeDefinitionParameter;
|
|
30
|
+
}
|
|
20
31
|
export interface PluginPluginOptions {
|
|
21
32
|
/**
|
|
22
33
|
* The options applied to the [Alloy framework](https://alloy-framework.github.io/alloy/) for rendering templates.
|
|
@@ -27,15 +38,20 @@ export interface PluginPluginOptions {
|
|
|
27
38
|
* @defaultValue false
|
|
28
39
|
*/
|
|
29
40
|
alloy?: PluginPluginAlloyOptions | boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The type definitions for the Plugin plugin.
|
|
43
|
+
*/
|
|
44
|
+
types?: PluginPluginTypesOptions;
|
|
30
45
|
}
|
|
31
46
|
export type PluginPluginUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup"> & {
|
|
32
|
-
|
|
47
|
+
plugin: PluginPluginOptions;
|
|
33
48
|
};
|
|
34
49
|
export type PluginPluginResolvedConfig = ResolvedConfig<PluginPluginUserConfig> & {
|
|
35
|
-
|
|
50
|
+
plugin: PluginPluginOptions;
|
|
36
51
|
};
|
|
37
52
|
export type PluginPluginContext<TResolvedConfig extends PluginPluginResolvedConfig = PluginPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
38
53
|
export declare type __ΩPluginPluginAlloyOptions = any[];
|
|
54
|
+
export declare type __ΩPluginPluginTypesOptions = any[];
|
|
39
55
|
export declare type __ΩPluginPluginOptions = any[];
|
|
40
56
|
export declare type __ΩPluginPluginUserConfig = any[];
|
|
41
57
|
export declare type __ΩPluginPluginResolvedConfig = any[];
|
package/dist/src/types/plugin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const __ΩPartial = ['T', 'Partial', 'l+e#!e"!fRb!Pde"!gN#"w"y'];
|
|
2
|
-
const __ΩRequired = ['T', 'Required', 'l+e#!e"!fRb!Pde"!gN##w"y'];
|
|
3
2
|
const __ΩPluginPluginAlloyOptions = [() => __ΩPartial, 'PrintTreeOptions', 'generatesJson', true, 'generatesMarkdown', 'PluginPluginAlloyOptions', 'P"w"o!"P)4#8>$)4%8>$MKw&y'];
|
|
4
|
-
const __Ω
|
|
5
|
-
const __Ω
|
|
6
|
-
const __Ω
|
|
3
|
+
const __ΩPluginPluginTypesOptions = ['TypeDefinitionParameter', 'options', 'userConfig', 'PluginPluginTypesOptions', 'P"w!4"8"w!4#8Mw$y'];
|
|
4
|
+
const __ΩPluginPluginOptions = [() => __ΩPluginPluginAlloyOptions, 'alloy', false, () => __ΩPluginPluginTypesOptions, 'types', 'PluginPluginOptions', 'PPn!)J4"8>#n$4%8Mw&y'];
|
|
5
|
+
const __ΩPluginPluginUserConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginUserConfig', 'P!Pn!4"MKw#y'];
|
|
6
|
+
const __ΩPluginPluginResolvedConfig = [() => __ΩPluginPluginOptions, 'plugin', 'PluginPluginResolvedConfig', 'P!Pn!4"MKw#y'];
|
|
7
7
|
const __ΩPluginPluginContext = [() => __ΩPluginPluginResolvedConfig, 'TResolvedConfig', 'PluginPluginContext', 'n!c"!w#y'];
|
|
8
8
|
|
|
9
|
-
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginUserConfig };
|
|
9
|
+
export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginContext, __ΩPluginPluginOptions, __ΩPluginPluginResolvedConfig, __ΩPluginPluginTypesOptions, __ΩPluginPluginUserConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-plugin",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.55",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -124,19 +124,20 @@
|
|
|
124
124
|
"@alloy-js/typescript": "^0.20.0",
|
|
125
125
|
"@babel/preset-typescript": "^7.28.5",
|
|
126
126
|
"@storm-software/tsup": "^0.2.48",
|
|
127
|
-
"@stryke/fs": "^0.33.
|
|
128
|
-
"@stryke/json": "^0.9.
|
|
129
|
-
"@stryke/path": "^0.21.
|
|
130
|
-
"@stryke/
|
|
131
|
-
"@stryke/
|
|
127
|
+
"@stryke/fs": "^0.33.8",
|
|
128
|
+
"@stryke/json": "^0.9.15",
|
|
129
|
+
"@stryke/path": "^0.21.6",
|
|
130
|
+
"@stryke/string-format": "^0.12.12",
|
|
131
|
+
"@stryke/type-checks": "^0.4.3",
|
|
132
|
+
"@stryke/types": "^0.10.12",
|
|
132
133
|
"defu": "^6.1.4",
|
|
133
134
|
"esbuild-plugin-babel": "^0.2.3",
|
|
134
135
|
"jiti": "^2.6.1",
|
|
135
|
-
"powerlines": "^0.
|
|
136
|
+
"powerlines": "^0.28.0"
|
|
136
137
|
},
|
|
137
138
|
"devDependencies": {
|
|
138
139
|
"@alloy-js/rollup-plugin": "^0.1.0",
|
|
139
|
-
"@powerlines/nx": "^0.10.
|
|
140
|
+
"@powerlines/nx": "^0.10.47",
|
|
140
141
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
141
142
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
142
143
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
|
@@ -146,5 +147,5 @@
|
|
|
146
147
|
"rollup-plugin-typescript2": "^0.36.0"
|
|
147
148
|
},
|
|
148
149
|
"publishConfig": { "access": "public" },
|
|
149
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "3feaa815e117c46d827eee84c3521e54670abb9b"
|
|
150
151
|
}
|
package/dist/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* -------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
⚡ Storm Software - Powerlines
|
|
4
|
-
|
|
5
|
-
This code was released as part of the Powerlines project. Powerlines
|
|
6
|
-
is maintained by Storm Software under the Apache-2.0 license, and is
|
|
7
|
-
free for commercial and private use. For more information, please visit
|
|
8
|
-
our licensing page at https://stormsoftware.com/licenses/projects/powerlines.
|
|
9
|
-
|
|
10
|
-
Website: https://stormsoftware.com
|
|
11
|
-
Repository: https://github.com/storm-software/powerlines
|
|
12
|
-
Documentation: https://docs.stormsoftware.com/projects/powerlines
|
|
13
|
-
Contact: https://stormsoftware.com/contact
|
|
14
|
-
|
|
15
|
-
SPDX-License-Identifier: Apache-2.0
|
|
16
|
-
|
|
17
|
-
------------------------------------------------------------------- */
|
|
18
|
-
|
|
19
|
-
/// <reference path="./src/types/plugin.d.ts" />
|
|
20
|
-
|
|
21
|
-
declare module "powerlines" {
|
|
22
|
-
export interface BaseConfig extends PluginPluginUserConfig {}
|
|
23
|
-
}
|