powerlines 0.37.56 → 0.37.57

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.
Files changed (89) hide show
  1. package/dist/api.cjs +2 -2
  2. package/dist/api.js +1 -1
  3. package/dist/astro.cjs +4 -4
  4. package/dist/astro.js +3 -3
  5. package/dist/{chunk-2VUAOV5V.js → chunk-36CMV3CQ.js} +3 -3
  6. package/dist/chunk-5CHXFWBK.cjs +12 -0
  7. package/dist/{chunk-NUYBKMON.js → chunk-63NHSIGB.js} +3 -3
  8. package/dist/{chunk-2ESGIL56.cjs → chunk-6GAEDFN4.cjs} +151 -3
  9. package/dist/{chunk-LFHXRRZX.cjs → chunk-7L2E5YIM.cjs} +5 -5
  10. package/dist/chunk-CIMSOZYQ.cjs +12 -0
  11. package/dist/{chunk-QQ6V5SC5.cjs → chunk-F3EMUOG6.cjs} +4 -4
  12. package/dist/{chunk-PQOEG6WQ.js → chunk-IUYN4H4X.js} +3 -3
  13. package/dist/{chunk-BSKRKIB5.cjs → chunk-NPOQ26XB.cjs} +4 -4
  14. package/dist/{chunk-L4OM5KXO.js → chunk-O5MRNC4W.js} +150 -3
  15. package/dist/{chunk-7LH63BFW.js → chunk-OVLE437L.js} +3 -3
  16. package/dist/{chunk-5OE3ACWC.js → chunk-UID2OOSN.js} +3 -3
  17. package/dist/esbuild.cjs +6 -6
  18. package/dist/esbuild.js +3 -3
  19. package/dist/farm.cjs +3 -3
  20. package/dist/farm.js +2 -2
  21. package/dist/index.cjs +10 -10
  22. package/dist/index.js +2 -2
  23. package/dist/lib/{chunk-DWKRVCBP.cjs → chunk-EFE7FA73.cjs} +169 -3
  24. package/dist/lib/chunk-EFE7FA73.cjs.map +1 -0
  25. package/dist/lib/{chunk-CIBV7IDT.js → chunk-S2BYV2S6.js} +150 -3
  26. package/dist/lib/chunk-S2BYV2S6.js.map +1 -0
  27. package/dist/lib/index.cjs +2 -2
  28. package/dist/lib/index.js +1 -1
  29. package/dist/lib/unplugin/factory.cjs +2 -2
  30. package/dist/lib/unplugin/factory.js +1 -1
  31. package/dist/lib/unplugin/index.cjs +2 -2
  32. package/dist/lib/unplugin/index.js +1 -1
  33. package/dist/next.cjs +4 -4
  34. package/dist/next.js +3 -3
  35. package/dist/nuxt.cjs +8 -8
  36. package/dist/nuxt.js +4 -4
  37. package/dist/plugin-utils/chunk-G4VBCQU2.cjs +14 -0
  38. package/dist/plugin-utils/chunk-G4VBCQU2.cjs.map +1 -0
  39. package/dist/plugin-utils/chunk-TKHJ5FOY.js +12 -0
  40. package/dist/plugin-utils/chunk-TKHJ5FOY.js.map +1 -0
  41. package/dist/plugin-utils/{context-Iv5cZYxg.d.cts → context-ImhXCCVn.d.cts} +1 -1
  42. package/dist/plugin-utils/{context-Iv5cZYxg.d.ts → context-ImhXCCVn.d.ts} +1 -1
  43. package/dist/plugin-utils/context-helpers.d.cts +1 -1
  44. package/dist/plugin-utils/context-helpers.d.ts +1 -1
  45. package/dist/plugin-utils/enforce.d.cts +1 -1
  46. package/dist/plugin-utils/enforce.d.ts +1 -1
  47. package/dist/plugin-utils/extend.d.cts +1 -1
  48. package/dist/plugin-utils/extend.d.ts +1 -1
  49. package/dist/plugin-utils/get-config-path.d.cts +1 -1
  50. package/dist/plugin-utils/get-config-path.d.ts +1 -1
  51. package/dist/plugin-utils/helpers.d.cts +1 -1
  52. package/dist/plugin-utils/helpers.d.ts +1 -1
  53. package/dist/plugin-utils/index.cjs +8 -3
  54. package/dist/plugin-utils/index.d.cts +2 -1
  55. package/dist/plugin-utils/index.d.ts +2 -1
  56. package/dist/plugin-utils/index.js +2 -1
  57. package/dist/plugin-utils/merge.d.cts +1 -1
  58. package/dist/plugin-utils/merge.d.ts +1 -1
  59. package/dist/plugin-utils/modules.cjs +13 -0
  60. package/dist/plugin-utils/modules.cjs.map +1 -0
  61. package/dist/plugin-utils/modules.d.cts +43 -0
  62. package/dist/plugin-utils/modules.d.ts +43 -0
  63. package/dist/plugin-utils/modules.js +4 -0
  64. package/dist/plugin-utils/modules.js.map +1 -0
  65. package/dist/plugin-utils/paths.d.cts +1 -1
  66. package/dist/plugin-utils/paths.d.ts +1 -1
  67. package/dist/rolldown.cjs +6 -6
  68. package/dist/rolldown.js +3 -3
  69. package/dist/rollup.cjs +3 -3
  70. package/dist/rollup.js +2 -2
  71. package/dist/rspack.cjs +3 -3
  72. package/dist/rspack.js +2 -2
  73. package/dist/tsdown.cjs +4 -4
  74. package/dist/tsdown.js +3 -3
  75. package/dist/tsup.cjs +4 -4
  76. package/dist/tsup.js +3 -3
  77. package/dist/unloader.cjs +3 -3
  78. package/dist/unloader.js +2 -2
  79. package/dist/unplugin.cjs +8 -8
  80. package/dist/unplugin.js +4 -4
  81. package/dist/vite.cjs +6 -6
  82. package/dist/vite.js +3 -3
  83. package/dist/webpack.cjs +6 -6
  84. package/dist/webpack.js +3 -3
  85. package/package.json +2 -2
  86. package/dist/chunk-JK5Y4ABM.cjs +0 -12
  87. package/dist/chunk-PCQFHZKL.cjs +0 -12
  88. package/dist/lib/chunk-CIBV7IDT.js.map +0 -1
  89. package/dist/lib/chunk-DWKRVCBP.cjs.map +0 -1
package/dist/esbuild.js CHANGED
@@ -1,7 +1,7 @@
1
- export { esbuild_default as default, esbuild, esbuild as "module.exports" } from './chunk-2VUAOV5V.js';
1
+ export { esbuild_default as default, esbuild, esbuild as "module.exports" } from './chunk-36CMV3CQ.js';
2
2
  import './chunk-BNVPJWSG.js';
3
- import './chunk-5OE3ACWC.js';
4
- import './chunk-L4OM5KXO.js';
3
+ import './chunk-UID2OOSN.js';
4
+ import './chunk-O5MRNC4W.js';
5
5
  import './chunk-PQXP7XQK.js';
6
6
  import './chunk-NITQ5IYP.js';
7
7
  import './chunk-2MYPFASJ.js';
package/dist/farm.cjs CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var chunkLFHXRRZX_cjs = require('./chunk-LFHXRRZX.cjs');
6
- require('./chunk-2ESGIL56.cjs');
5
+ var chunk7L2E5YIM_cjs = require('./chunk-7L2E5YIM.cjs');
6
+ require('./chunk-6GAEDFN4.cjs');
7
7
  require('./chunk-B6DVCLP5.cjs');
8
8
  require('./chunk-V5WOGN7O.cjs');
9
9
  require('./chunk-Z6ARQDHR.cjs');
10
10
  require('./chunk-PK6SKIKE.cjs');
11
11
  var unplugin = require('unplugin');
12
12
 
13
- var farm = unplugin.createFarmPlugin(chunkLFHXRRZX_cjs.createUnpluginFactory("farm"));
13
+ var farm = unplugin.createFarmPlugin(chunk7L2E5YIM_cjs.createUnpluginFactory("farm"));
14
14
  var farm_default = farm;
15
15
 
16
16
  exports.default = farm_default;
package/dist/farm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createUnpluginFactory } from './chunk-5OE3ACWC.js';
2
- import './chunk-L4OM5KXO.js';
1
+ import { createUnpluginFactory } from './chunk-UID2OOSN.js';
2
+ import './chunk-O5MRNC4W.js';
3
3
  import './chunk-PQXP7XQK.js';
4
4
  import './chunk-NITQ5IYP.js';
5
5
  import './chunk-2MYPFASJ.js';
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ require('./chunk-4JCNAKOE.cjs');
13
13
  require('./chunk-D6GGZQLC.cjs');
14
14
  var chunkA7AUGAHH_cjs = require('./chunk-A7AUGAHH.cjs');
15
15
  var chunk42ZHOCZJ_cjs = require('./chunk-42ZHOCZJ.cjs');
16
- var chunk2ESGIL56_cjs = require('./chunk-2ESGIL56.cjs');
16
+ var chunk6GAEDFN4_cjs = require('./chunk-6GAEDFN4.cjs');
17
17
  var chunkB6DVCLP5_cjs = require('./chunk-B6DVCLP5.cjs');
18
18
  var chunkV5WOGN7O_cjs = require('./chunk-V5WOGN7O.cjs');
19
19
  var chunkZ6ARQDHR_cjs = require('./chunk-Z6ARQDHR.cjs');
@@ -27,10 +27,10 @@ chunkPK6SKIKE_cjs.__name(defineConfig, "defineConfig");
27
27
  async function createPowerlines(options = {}) {
28
28
  options.root ??= process.cwd();
29
29
  const workspaceRoot = getWorkspaceRoot.getWorkspaceRoot(options.root);
30
- return chunk2ESGIL56_cjs.PowerlinesAPI.from(workspaceRoot, options);
30
+ return chunk6GAEDFN4_cjs.PowerlinesAPI.from(workspaceRoot, options);
31
31
  }
32
32
  chunkPK6SKIKE_cjs.__name(createPowerlines, "createPowerlines");
33
- var index_default = chunk2ESGIL56_cjs.PowerlinesAPI;
33
+ var index_default = chunk6GAEDFN4_cjs.PowerlinesAPI;
34
34
 
35
35
  Object.defineProperty(exports, "STORAGE_PRESETS", {
36
36
  enumerable: true,
@@ -50,31 +50,31 @@ Object.defineProperty(exports, "HOOKS_LIST_ORDERS", {
50
50
  });
51
51
  Object.defineProperty(exports, "FileId", {
52
52
  enumerable: true,
53
- get: function () { return chunk2ESGIL56_cjs.FileId; }
53
+ get: function () { return chunk6GAEDFN4_cjs.FileId; }
54
54
  });
55
55
  Object.defineProperty(exports, "FileMetadata", {
56
56
  enumerable: true,
57
- get: function () { return chunk2ESGIL56_cjs.FileMetadata; }
57
+ get: function () { return chunk6GAEDFN4_cjs.FileMetadata; }
58
58
  });
59
59
  Object.defineProperty(exports, "FileMetadata_KeyValuePair", {
60
60
  enumerable: true,
61
- get: function () { return chunk2ESGIL56_cjs.FileMetadata_KeyValuePair; }
61
+ get: function () { return chunk6GAEDFN4_cjs.FileMetadata_KeyValuePair; }
62
62
  });
63
63
  Object.defineProperty(exports, "FileStorage", {
64
64
  enumerable: true,
65
- get: function () { return chunk2ESGIL56_cjs.FileStorage; }
65
+ get: function () { return chunk6GAEDFN4_cjs.FileStorage; }
66
66
  });
67
67
  Object.defineProperty(exports, "FileSystem", {
68
68
  enumerable: true,
69
- get: function () { return chunk2ESGIL56_cjs.FileSystem; }
69
+ get: function () { return chunk6GAEDFN4_cjs.FileSystem; }
70
70
  });
71
71
  Object.defineProperty(exports, "PowerlinesAPI", {
72
72
  enumerable: true,
73
- get: function () { return chunk2ESGIL56_cjs.PowerlinesAPI; }
73
+ get: function () { return chunk6GAEDFN4_cjs.PowerlinesAPI; }
74
74
  });
75
75
  Object.defineProperty(exports, "_capnpFileId", {
76
76
  enumerable: true,
77
- get: function () { return chunk2ESGIL56_cjs._capnpFileId; }
77
+ get: function () { return chunk6GAEDFN4_cjs._capnpFileId; }
78
78
  });
79
79
  Object.defineProperty(exports, "KNOWN_PLUGIN_FIELDS", {
80
80
  enumerable: true,
package/dist/index.js CHANGED
@@ -9,8 +9,8 @@ import './chunk-OYASPHNL.js';
9
9
  import './chunk-OD4BINRW.js';
10
10
  export { STORAGE_PRESETS, __VFS_PATCH__, __VFS_REVERT__ } from './chunk-KXRVVFNK.js';
11
11
  export { HOOKS_LIST_ORDERS } from './chunk-CCJQBJKQ.js';
12
- import { PowerlinesAPI } from './chunk-L4OM5KXO.js';
13
- export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId } from './chunk-L4OM5KXO.js';
12
+ import { PowerlinesAPI } from './chunk-O5MRNC4W.js';
13
+ export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId } from './chunk-O5MRNC4W.js';
14
14
  export { KNOWN_PLUGIN_FIELDS, PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS } from './chunk-PQXP7XQK.js';
15
15
  export { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from './chunk-NITQ5IYP.js';
16
16
  export { SUPPORTED_COMMANDS } from './chunk-2MYPFASJ.js';
@@ -13,6 +13,7 @@ var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
13
13
  var types = require('@storm-software/config-tools/types');
14
14
  var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
15
15
  var unplugin = require('unplugin');
16
+ var core = require('@babel/core');
16
17
  var console = require('@storm-software/config-tools/logger/console');
17
18
  var toArray = require('@stryke/convert/to-array');
18
19
  var helpers = require('@stryke/fs/helpers');
@@ -35,6 +36,8 @@ var isSetString = require('@stryke/type-checks/is-set-string');
35
36
  var isString = require('@stryke/type-checks/is-string');
36
37
  var chalk3 = require('chalk');
37
38
  var Handlebars = require('handlebars');
39
+ var helperPluginUtils = require('@babel/helper-plugin-utils');
40
+ var t = require('@babel/types');
38
41
  var isParentPath = require('@stryke/path/is-parent-path');
39
42
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
40
43
  var tsMorph = require('ts-morph');
@@ -48,12 +51,142 @@ var titleCase = require('@stryke/string-format/title-case');
48
51
 
49
52
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
50
53
 
54
+ function _interopNamespace(e) {
55
+ if (e && e.__esModule) return e;
56
+ var n = Object.create(null);
57
+ if (e) {
58
+ Object.keys(e).forEach(function (k) {
59
+ if (k !== 'default') {
60
+ var d = Object.getOwnPropertyDescriptor(e, k);
61
+ Object.defineProperty(n, k, d.get ? d : {
62
+ enumerable: true,
63
+ get: function () { return e[k]; }
64
+ });
65
+ }
66
+ });
67
+ }
68
+ n.default = e;
69
+ return Object.freeze(n);
70
+ }
71
+
51
72
  var chalk3__default = /*#__PURE__*/_interopDefault(chalk3);
52
73
  var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
74
+ var t__namespace = /*#__PURE__*/_interopNamespace(t);
53
75
 
54
76
  // package.json
55
77
  var package_default = {
56
- version: "0.37.55"};
78
+ version: "0.37.56"};
79
+
80
+ // src/plugin-utils/modules.ts
81
+ function isBuiltinModule(context, moduleName) {
82
+ const prefix = context.config.output?.builtinPrefix || context.config?.framework || "powerlines";
83
+ return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
84
+ }
85
+ chunkPK6SKIKE_cjs.__name(isBuiltinModule, "isBuiltinModule");
86
+
87
+ // src/internal/babel/module-resolver-plugin.ts
88
+ function resolveModulePath(nodePath, state) {
89
+ if (!t__namespace.isStringLiteral(nodePath.node) || !state.resolveAll && !isBuiltinModule(state.context, nodePath.node.value)) {
90
+ return;
91
+ }
92
+ const resolvedPath = state.context?.fs.resolveSync(nodePath.node.value);
93
+ if (resolvedPath) {
94
+ nodePath.replaceWith(t__namespace.stringLiteral(
95
+ // Remove the file extension if it exists
96
+ resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
97
+ ));
98
+ }
99
+ }
100
+ chunkPK6SKIKE_cjs.__name(resolveModulePath, "resolveModulePath");
101
+ var TRANSFORM_FUNCTIONS = [
102
+ "require",
103
+ "require.resolve",
104
+ "System.import",
105
+ // Jest methods
106
+ "jest.genMockFromModule",
107
+ "jest.mock",
108
+ "jest.unmock",
109
+ "jest.doMock",
110
+ // eslint-disable-next-line @cspell/spellchecker
111
+ "jest.dontMock",
112
+ "jest.setMock",
113
+ "jest.requireActual",
114
+ "jest.requireMock",
115
+ // Older Jest methods
116
+ "require.requireActual",
117
+ "require.requireMock"
118
+ ];
119
+ function matchesPattern(state, calleePath, pattern) {
120
+ const { node } = calleePath;
121
+ if (t__namespace.isMemberExpression(node)) {
122
+ return calleePath.matchesPattern(pattern);
123
+ }
124
+ if (!t__namespace.isIdentifier(node) || pattern.includes(".")) {
125
+ return false;
126
+ }
127
+ const name = pattern.split(".")[0];
128
+ return node.name === name;
129
+ }
130
+ chunkPK6SKIKE_cjs.__name(matchesPattern, "matchesPattern");
131
+ var importVisitors = {
132
+ CallExpression: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
133
+ if (state.moduleResolverVisited.has(nodePath)) {
134
+ return;
135
+ }
136
+ const calleePath = nodePath.get("callee");
137
+ if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t__namespace.isImport(nodePath.node.callee)) {
138
+ state.moduleResolverVisited.add(nodePath);
139
+ resolveModulePath(nodePath.get("arguments.0"), state);
140
+ }
141
+ }, "CallExpression"),
142
+ // eslint-disable-next-line ts/naming-convention
143
+ "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
144
+ if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
145
+ return;
146
+ }
147
+ state.moduleResolverVisited.add(nodePath);
148
+ resolveModulePath(nodePath.get("source"), state);
149
+ }, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
150
+ };
151
+ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context, options) => {
152
+ return helperPluginUtils.declare(/* @__PURE__ */ chunkPK6SKIKE_cjs.__name(function builder(api) {
153
+ let moduleResolverVisited = /* @__PURE__ */ new Set();
154
+ return {
155
+ name: "powerlines:module-resolver",
156
+ manipulateOptions(opts) {
157
+ opts.filename ??= "unknown";
158
+ },
159
+ pre() {
160
+ moduleResolverVisited = /* @__PURE__ */ new Set();
161
+ },
162
+ visitor: {
163
+ Program: {
164
+ enter(programPath, state) {
165
+ programPath.traverse(importVisitors, {
166
+ ...state,
167
+ context,
168
+ moduleResolverVisited,
169
+ api,
170
+ resolveAll: options?.resolveAll ?? false
171
+ });
172
+ },
173
+ exit(programPath, state) {
174
+ programPath.traverse(importVisitors, {
175
+ ...state,
176
+ context,
177
+ moduleResolverVisited,
178
+ api,
179
+ resolveAll: options?.resolveAll ?? false
180
+ });
181
+ }
182
+ }
183
+ },
184
+ post() {
185
+ moduleResolverVisited.clear();
186
+ }
187
+ };
188
+ }, "builder"));
189
+ }, "moduleResolverBabelPlugin");
57
190
  function formatTypes(code) {
58
191
  return code.replace(
59
192
  // eslint-disable-next-line regexp/no-super-linear-backtracking
@@ -469,6 +602,39 @@ ${console.formatLogMessage({
469
602
  }
470
603
  context.debug("Transforming built-ins runtime modules files.");
471
604
  const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
605
+ const result2 = await core.transformAsync(file.code.toString(), {
606
+ highlightCode: true,
607
+ code: true,
608
+ ast: false,
609
+ cloneInputAst: false,
610
+ comments: true,
611
+ sourceType: "module",
612
+ configFile: false,
613
+ babelrc: false,
614
+ envName: context.config.mode,
615
+ caller: {
616
+ name: "powerlines"
617
+ },
618
+ ...context.config.transform.babel,
619
+ filename: file.path,
620
+ plugins: [
621
+ [
622
+ "@babel/plugin-syntax-typescript"
623
+ ],
624
+ [
625
+ moduleResolverBabelPlugin(context)
626
+ ]
627
+ ]
628
+ });
629
+ if (!result2?.code) {
630
+ throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
631
+ }
632
+ if (!file.id) {
633
+ context.warn(`File ID is missing for a built-in runtime file at ${file.path}.`);
634
+ file.id = replace.replacePath(replace.replacePath(file.path, context.workspaceConfig.workspaceRoot), context.builtinsPath);
635
+ }
636
+ context.trace(`Writing transformed built-in runtime file ${file.id}.`);
637
+ await context.emitBuiltin(result2.code, file.id);
472
638
  return append.appendPath(file.path, context.builtinsPath);
473
639
  }));
474
640
  const typescriptPath = await resolve.resolvePackage("typescript");
@@ -1114,5 +1280,5 @@ function createUnpluginFactory(variant, decorate) {
1114
1280
  chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
1115
1281
 
1116
1282
  exports.createUnpluginFactory = createUnpluginFactory;
1117
- //# sourceMappingURL=chunk-DWKRVCBP.cjs.map
1118
- //# sourceMappingURL=chunk-DWKRVCBP.cjs.map
1283
+ //# sourceMappingURL=chunk-EFE7FA73.cjs.map
1284
+ //# sourceMappingURL=chunk-EFE7FA73.cjs.map