@powerlines/plugin-plugin 0.12.2 → 0.12.3

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.
@@ -6,6 +6,7 @@ var src_types_plugin = require('./types/plugin.cjs');
6
6
  var alloyPlugin = require('@alloy-js/rollup-plugin');
7
7
  var types = require('@storm-software/config-tools/types');
8
8
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
9
+ var toArray = require('@stryke/convert/to-array');
9
10
  var stormJson = require('@stryke/json/storm-json');
10
11
  var titleCase = require('@stryke/string-format/title-case');
11
12
  var isSetString = require('@stryke/type-checks/is-set-string');
@@ -34,7 +35,7 @@ const plugin = __assignType((options = {}) => {
34
35
  this.log(types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines plugin.");
35
36
  return {
36
37
  type: "library",
37
- entry: ["src/**/*.ts", "src/**/*.tsx"],
38
+ entry: options.alloy ? ["src/index.tsx"] : ["src/index.ts"],
38
39
  output: {
39
40
  format: ["cjs", "esm"]
40
41
  },
@@ -56,29 +57,27 @@ const plugin = __assignType((options = {}) => {
56
57
  await this.fs.write(this.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(this.tsconfig.tsconfigJson));
57
58
  }
58
59
  }, ['configResolved', 'P"/!']),
59
- types: __assignType(async function types(code) {
60
- if (!options.types?.userConfig) {
60
+ types: __assignType(async function types$1(code) {
61
+ if (!options.types?.userConfig || !this.packageJson?.name) {
61
62
  return;
62
63
  }
63
64
  let typeDef;
64
65
  if (isSetString.isSetString(options.types.userConfig) &&
65
- !options.types.userConfig.includes("#") &&
66
- this.packageJson?.name) {
67
- const pluginRoot = await this.resolve(this.packageJson.name);
68
- if (pluginRoot &&
69
- this.packageJson?.name &&
70
- !(await this.resolve(options.types.userConfig, pluginRoot.id))) {
71
- typeDef = {
72
- file: this.packageJson.name,
73
- name: options.types.userConfig
74
- };
75
- }
66
+ !options.types.userConfig.includes("#")) {
67
+ typeDef = {
68
+ file: this.packageJson.name,
69
+ name: options.types.userConfig
70
+ };
76
71
  }
77
- if (!typeDef) {
72
+ else {
78
73
  typeDef = parseTypeDefinition.parseTypeDefinition(options.types.userConfig);
79
74
  if (!typeDef) {
80
75
  return;
81
76
  }
77
+ if (!toArray.toArray(this.config.entry).includes(typeDef.file)) {
78
+ this.log(types.LogLevelLabel.WARN, `The specified user configuration file "${typeDef.file}" is not included in the build entry points.`);
79
+ }
80
+ typeDef.file = `${this.packageJson.name}/${typeDef.file.replace(/^\.\//, "")}`;
82
81
  }
83
82
  return `${code || ""}
84
83
 
package/dist/src/index.js CHANGED
@@ -3,6 +3,7 @@ export { __ΩPluginPluginAlloyOptions, __ΩPluginPluginResolvedConfig, __ΩPlugi
3
3
  import alloyPlugin from '@alloy-js/rollup-plugin';
4
4
  import { LogLevelLabel } from '@storm-software/config-tools/types';
5
5
  import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
6
+ import { toArray } from '@stryke/convert/to-array';
6
7
  import { StormJSON } from '@stryke/json/storm-json';
7
8
  import { titleCase } from '@stryke/string-format/title-case';
8
9
  import { isSetString } from '@stryke/type-checks/is-set-string';
@@ -31,7 +32,7 @@ const plugin = __assignType((options = {}) => {
31
32
  this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines plugin.");
32
33
  return {
33
34
  type: "library",
34
- entry: ["src/**/*.ts", "src/**/*.tsx"],
35
+ entry: options.alloy ? ["src/index.tsx"] : ["src/index.ts"],
35
36
  output: {
36
37
  format: ["cjs", "esm"]
37
38
  },
@@ -54,28 +55,26 @@ const plugin = __assignType((options = {}) => {
54
55
  }
55
56
  }, ['configResolved', 'P"/!']),
56
57
  types: __assignType(async function types(code) {
57
- if (!options.types?.userConfig) {
58
+ if (!options.types?.userConfig || !this.packageJson?.name) {
58
59
  return;
59
60
  }
60
61
  let typeDef;
61
62
  if (isSetString(options.types.userConfig) &&
62
- !options.types.userConfig.includes("#") &&
63
- this.packageJson?.name) {
64
- const pluginRoot = await this.resolve(this.packageJson.name);
65
- if (pluginRoot &&
66
- this.packageJson?.name &&
67
- !(await this.resolve(options.types.userConfig, pluginRoot.id))) {
68
- typeDef = {
69
- file: this.packageJson.name,
70
- name: options.types.userConfig
71
- };
72
- }
63
+ !options.types.userConfig.includes("#")) {
64
+ typeDef = {
65
+ file: this.packageJson.name,
66
+ name: options.types.userConfig
67
+ };
73
68
  }
74
- if (!typeDef) {
69
+ else {
75
70
  typeDef = parseTypeDefinition(options.types.userConfig);
76
71
  if (!typeDef) {
77
72
  return;
78
73
  }
74
+ if (!toArray(this.config.entry).includes(typeDef.file)) {
75
+ this.log(LogLevelLabel.WARN, `The specified user configuration file "${typeDef.file}" is not included in the build entry points.`);
76
+ }
77
+ typeDef.file = `${this.packageJson.name}/${typeDef.file.replace(/^\.\//, "")}`;
79
78
  }
80
79
  return `${code || ""}
81
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-plugin",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -130,12 +130,13 @@
130
130
  "@stryke/string-format": "^0.12.13",
131
131
  "@stryke/type-checks": "^0.4.4",
132
132
  "@stryke/types": "^0.10.13",
133
+ "@stryke/convert": "^0.6.13",
133
134
  "defu": "^6.1.4",
134
135
  "jiti": "^2.6.1",
135
- "powerlines": "^0.30.1"
136
+ "powerlines": "^0.30.2"
136
137
  },
137
138
  "devDependencies": {
138
- "@powerlines/nx": "^0.10.50",
139
+ "@powerlines/nx": "^0.10.51",
139
140
  "@rollup/plugin-commonjs": "^28.0.9",
140
141
  "@rollup/plugin-node-resolve": "^16.0.3",
141
142
  "@types/babel__helper-plugin-utils": "^7.10.3",
@@ -144,5 +145,5 @@
144
145
  "rollup-plugin-typescript2": "^0.36.0"
145
146
  },
146
147
  "publishConfig": { "access": "public" },
147
- "gitHead": "499105ba7cabc6fa139bbc6829746a15c5c59357"
148
+ "gitHead": "cac32f77cda8960ceaf2645f04f2c88f16eb4aae"
148
149
  }