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/api.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2ESGIL56_cjs = require('./chunk-2ESGIL56.cjs');
3
+ var chunk6GAEDFN4_cjs = require('./chunk-6GAEDFN4.cjs');
4
4
  require('./chunk-B6DVCLP5.cjs');
5
5
  require('./chunk-V5WOGN7O.cjs');
6
6
  require('./chunk-Z6ARQDHR.cjs');
@@ -10,7 +10,7 @@ require('./chunk-PK6SKIKE.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "PowerlinesAPI", {
12
12
  enumerable: true,
13
- get: function () { return chunk2ESGIL56_cjs.PowerlinesAPI; }
13
+ get: function () { return chunk6GAEDFN4_cjs.PowerlinesAPI; }
14
14
  });
15
15
  //# sourceMappingURL=api.cjs.map
16
16
  //# sourceMappingURL=api.cjs.map
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { PowerlinesAPI } from './chunk-L4OM5KXO.js';
1
+ export { PowerlinesAPI } from './chunk-O5MRNC4W.js';
2
2
  import './chunk-PQXP7XQK.js';
3
3
  import './chunk-NITQ5IYP.js';
4
4
  import './chunk-2MYPFASJ.js';
package/dist/astro.cjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var chunkBSKRKIB5_cjs = require('./chunk-BSKRKIB5.cjs');
5
+ var chunkNPOQ26XB_cjs = require('./chunk-NPOQ26XB.cjs');
6
6
  require('./chunk-MKIL6OVG.cjs');
7
- require('./chunk-LFHXRRZX.cjs');
8
- require('./chunk-2ESGIL56.cjs');
7
+ require('./chunk-7L2E5YIM.cjs');
8
+ require('./chunk-6GAEDFN4.cjs');
9
9
  require('./chunk-B6DVCLP5.cjs');
10
10
  require('./chunk-V5WOGN7O.cjs');
11
11
  require('./chunk-Z6ARQDHR.cjs');
@@ -15,7 +15,7 @@ var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
15
15
  var astro = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((config) => ({
16
16
  vite: {
17
17
  plugins: [
18
- chunkBSKRKIB5_cjs.vite_default(config)
18
+ chunkNPOQ26XB_cjs.vite_default(config)
19
19
  ]
20
20
  }
21
21
  }), "astro");
package/dist/astro.js CHANGED
@@ -1,7 +1,7 @@
1
- import { vite_default } from './chunk-PQOEG6WQ.js';
1
+ import { vite_default } from './chunk-IUYN4H4X.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';
@@ -1,5 +1,5 @@
1
1
  import { extractESBuildConfig } from './chunk-BNVPJWSG.js';
2
- import { createUnpluginFactory } from './chunk-5OE3ACWC.js';
2
+ import { createUnpluginFactory } from './chunk-UID2OOSN.js';
3
3
  import { __name } from './chunk-7QVYU63E.js';
4
4
  import { isUndefined } from '@stryke/type-checks/is-undefined';
5
5
  import { createEsbuildPlugin } from 'unplugin';
@@ -29,5 +29,5 @@ var esbuild = createEsbuildPlugin(createUnpluginFactory("esbuild", (api, plugin)
29
29
  var esbuild_default = esbuild;
30
30
 
31
31
  export { esbuild, esbuild_default };
32
- //# sourceMappingURL=chunk-2VUAOV5V.js.map
33
- //# sourceMappingURL=chunk-2VUAOV5V.js.map
32
+ //# sourceMappingURL=chunk-36CMV3CQ.js.map
33
+ //# sourceMappingURL=chunk-36CMV3CQ.js.map
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunk7L2E5YIM_cjs = require('./chunk-7L2E5YIM.cjs');
4
+ var unplugin = require('unplugin');
5
+
6
+ var rolldown = unplugin.createRolldownPlugin(chunk7L2E5YIM_cjs.createUnpluginFactory("rolldown"));
7
+ var rolldown_default = rolldown;
8
+
9
+ exports.rolldown = rolldown;
10
+ exports.rolldown_default = rolldown_default;
11
+ //# sourceMappingURL=chunk-5CHXFWBK.cjs.map
12
+ //# sourceMappingURL=chunk-5CHXFWBK.cjs.map
@@ -1,9 +1,9 @@
1
- import { createUnpluginFactory } from './chunk-5OE3ACWC.js';
1
+ import { createUnpluginFactory } from './chunk-UID2OOSN.js';
2
2
  import { createRolldownPlugin } from 'unplugin';
3
3
 
4
4
  var rolldown = createRolldownPlugin(createUnpluginFactory("rolldown"));
5
5
  var rolldown_default = rolldown;
6
6
 
7
7
  export { rolldown, rolldown_default };
8
- //# sourceMappingURL=chunk-NUYBKMON.js.map
9
- //# sourceMappingURL=chunk-NUYBKMON.js.map
8
+ //# sourceMappingURL=chunk-63NHSIGB.js.map
9
+ //# sourceMappingURL=chunk-63NHSIGB.js.map
@@ -3,6 +3,7 @@
3
3
  var chunkB6DVCLP5_cjs = require('./chunk-B6DVCLP5.cjs');
4
4
  var chunkV5WOGN7O_cjs = require('./chunk-V5WOGN7O.cjs');
5
5
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
6
+ var core = require('@babel/core');
6
7
  var console = require('@storm-software/config-tools/logger/console');
7
8
  var toArray = require('@stryke/convert/to-array');
8
9
  var helpers = require('@stryke/fs/helpers');
@@ -25,6 +26,8 @@ var isSetString = require('@stryke/type-checks/is-set-string');
25
26
  var isString = require('@stryke/type-checks/is-string');
26
27
  var chalk5 = require('chalk');
27
28
  var Handlebars = require('handlebars');
29
+ var helperPluginUtils = require('@babel/helper-plugin-utils');
30
+ var t = require('@babel/types');
28
31
  var isParentPath = require('@stryke/path/is-parent-path');
29
32
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
30
33
  var tsMorph = require('ts-morph');
@@ -100,15 +103,127 @@ function _interopNamespace(e) {
100
103
 
101
104
  var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
102
105
  var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
106
+ var t__namespace = /*#__PURE__*/_interopNamespace(t);
103
107
  var defu7__default = /*#__PURE__*/_interopDefault(defu7);
104
108
  var ts__default = /*#__PURE__*/_interopDefault(ts);
105
109
  var $__namespace = /*#__PURE__*/_interopNamespace($);
106
110
 
107
111
  // package.json
108
112
  var name = "powerlines";
109
- var version = "0.37.55";
113
+ var version = "0.37.56";
110
114
  var package_default = {
111
115
  version};
116
+
117
+ // src/plugin-utils/modules.ts
118
+ function isBuiltinModule(context, moduleName) {
119
+ const prefix = context.config.output?.builtinPrefix || context.config?.framework || "powerlines";
120
+ return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
121
+ }
122
+ chunkPK6SKIKE_cjs.__name(isBuiltinModule, "isBuiltinModule");
123
+
124
+ // src/internal/babel/module-resolver-plugin.ts
125
+ function resolveModulePath(nodePath, state) {
126
+ if (!t__namespace.isStringLiteral(nodePath.node) || !state.resolveAll && !isBuiltinModule(state.context, nodePath.node.value)) {
127
+ return;
128
+ }
129
+ const resolvedPath = state.context?.fs.resolveSync(nodePath.node.value);
130
+ if (resolvedPath) {
131
+ nodePath.replaceWith(t__namespace.stringLiteral(
132
+ // Remove the file extension if it exists
133
+ resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
134
+ ));
135
+ }
136
+ }
137
+ chunkPK6SKIKE_cjs.__name(resolveModulePath, "resolveModulePath");
138
+ var TRANSFORM_FUNCTIONS = [
139
+ "require",
140
+ "require.resolve",
141
+ "System.import",
142
+ // Jest methods
143
+ "jest.genMockFromModule",
144
+ "jest.mock",
145
+ "jest.unmock",
146
+ "jest.doMock",
147
+ // eslint-disable-next-line @cspell/spellchecker
148
+ "jest.dontMock",
149
+ "jest.setMock",
150
+ "jest.requireActual",
151
+ "jest.requireMock",
152
+ // Older Jest methods
153
+ "require.requireActual",
154
+ "require.requireMock"
155
+ ];
156
+ function matchesPattern(state, calleePath, pattern) {
157
+ const { node } = calleePath;
158
+ if (t__namespace.isMemberExpression(node)) {
159
+ return calleePath.matchesPattern(pattern);
160
+ }
161
+ if (!t__namespace.isIdentifier(node) || pattern.includes(".")) {
162
+ return false;
163
+ }
164
+ const name2 = pattern.split(".")[0];
165
+ return node.name === name2;
166
+ }
167
+ chunkPK6SKIKE_cjs.__name(matchesPattern, "matchesPattern");
168
+ var importVisitors = {
169
+ CallExpression: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
170
+ if (state.moduleResolverVisited.has(nodePath)) {
171
+ return;
172
+ }
173
+ const calleePath = nodePath.get("callee");
174
+ if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t__namespace.isImport(nodePath.node.callee)) {
175
+ state.moduleResolverVisited.add(nodePath);
176
+ resolveModulePath(nodePath.get("arguments.0"), state);
177
+ }
178
+ }, "CallExpression"),
179
+ // eslint-disable-next-line ts/naming-convention
180
+ "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
181
+ if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
182
+ return;
183
+ }
184
+ state.moduleResolverVisited.add(nodePath);
185
+ resolveModulePath(nodePath.get("source"), state);
186
+ }, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
187
+ };
188
+ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context, options) => {
189
+ return helperPluginUtils.declare(/* @__PURE__ */ chunkPK6SKIKE_cjs.__name(function builder(api) {
190
+ let moduleResolverVisited = /* @__PURE__ */ new Set();
191
+ return {
192
+ name: "powerlines:module-resolver",
193
+ manipulateOptions(opts) {
194
+ opts.filename ??= "unknown";
195
+ },
196
+ pre() {
197
+ moduleResolverVisited = /* @__PURE__ */ new Set();
198
+ },
199
+ visitor: {
200
+ Program: {
201
+ enter(programPath, state) {
202
+ programPath.traverse(importVisitors, {
203
+ ...state,
204
+ context,
205
+ moduleResolverVisited,
206
+ api,
207
+ resolveAll: options?.resolveAll ?? false
208
+ });
209
+ },
210
+ exit(programPath, state) {
211
+ programPath.traverse(importVisitors, {
212
+ ...state,
213
+ context,
214
+ moduleResolverVisited,
215
+ api,
216
+ resolveAll: options?.resolveAll ?? false
217
+ });
218
+ }
219
+ }
220
+ },
221
+ post() {
222
+ moduleResolverVisited.clear();
223
+ }
224
+ };
225
+ }, "builder"));
226
+ }, "moduleResolverBabelPlugin");
112
227
  var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
113
228
  static {
114
229
  chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystemHost");
@@ -4398,6 +4513,39 @@ ${console.formatLogMessage({
4398
4513
  }
4399
4514
  context.debug("Transforming built-ins runtime modules files.");
4400
4515
  const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
4516
+ const result2 = await core.transformAsync(file.code.toString(), {
4517
+ highlightCode: true,
4518
+ code: true,
4519
+ ast: false,
4520
+ cloneInputAst: false,
4521
+ comments: true,
4522
+ sourceType: "module",
4523
+ configFile: false,
4524
+ babelrc: false,
4525
+ envName: context.config.mode,
4526
+ caller: {
4527
+ name: "powerlines"
4528
+ },
4529
+ ...context.config.transform.babel,
4530
+ filename: file.path,
4531
+ plugins: [
4532
+ [
4533
+ "@babel/plugin-syntax-typescript"
4534
+ ],
4535
+ [
4536
+ moduleResolverBabelPlugin(context)
4537
+ ]
4538
+ ]
4539
+ });
4540
+ if (!result2?.code) {
4541
+ throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
4542
+ }
4543
+ if (!file.id) {
4544
+ context.warn(`File ID is missing for a built-in runtime file at ${file.path}.`);
4545
+ file.id = replace.replacePath(replace.replacePath(file.path, context.workspaceConfig.workspaceRoot), context.builtinsPath);
4546
+ }
4547
+ context.trace(`Writing transformed built-in runtime file ${file.id}.`);
4548
+ await context.emitBuiltin(result2.code, file.id);
4401
4549
  return append.appendPath(file.path, context.builtinsPath);
4402
4550
  }));
4403
4551
  const typescriptPath = await resolve.resolvePackage("typescript");
@@ -4944,5 +5092,5 @@ exports.extendLog = extendLog;
4944
5092
  exports.isUnpluginBuilderVariant = isUnpluginBuilderVariant;
4945
5093
  exports.name = name;
4946
5094
  exports.version = version;
4947
- //# sourceMappingURL=chunk-2ESGIL56.cjs.map
4948
- //# sourceMappingURL=chunk-2ESGIL56.cjs.map
5095
+ //# sourceMappingURL=chunk-6GAEDFN4.cjs.map
5096
+ //# sourceMappingURL=chunk-6GAEDFN4.cjs.map
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2ESGIL56_cjs = require('./chunk-2ESGIL56.cjs');
3
+ var chunk6GAEDFN4_cjs = require('./chunk-6GAEDFN4.cjs');
4
4
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
5
5
  var types = require('@storm-software/config-tools/types');
6
6
  var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
@@ -27,7 +27,7 @@ chunkPK6SKIKE_cjs.__name(getString, "getString");
27
27
  // src/lib/unplugin/factory.ts
28
28
  function createUnpluginFactory(variant, decorate) {
29
29
  return (config, meta) => {
30
- const log = chunk2ESGIL56_cjs.createLog("unplugin", config);
30
+ const log = chunk6GAEDFN4_cjs.createLog("unplugin", config);
31
31
  log(types.LogLevelLabel.DEBUG, "Initializing Unplugin");
32
32
  try {
33
33
  const userConfig = {
@@ -38,7 +38,7 @@ function createUnpluginFactory(variant, decorate) {
38
38
  let api;
39
39
  async function buildStart() {
40
40
  log(types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
41
- api = await chunk2ESGIL56_cjs.PowerlinesAPI.from(getWorkspaceRoot.getWorkspaceRoot(process.cwd()), userConfig);
41
+ api = await chunk6GAEDFN4_cjs.PowerlinesAPI.from(getWorkspaceRoot.getWorkspaceRoot(process.cwd()), userConfig);
42
42
  unplugin.setParseImpl(api.context.parse);
43
43
  log(types.LogLevelLabel.DEBUG, "Preparing build artifacts for the Powerlines project...");
44
44
  await api.prepare({
@@ -137,5 +137,5 @@ chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
137
137
 
138
138
  exports.createUnpluginFactory = createUnpluginFactory;
139
139
  exports.getString = getString;
140
- //# sourceMappingURL=chunk-LFHXRRZX.cjs.map
141
- //# sourceMappingURL=chunk-LFHXRRZX.cjs.map
140
+ //# sourceMappingURL=chunk-7L2E5YIM.cjs.map
141
+ //# sourceMappingURL=chunk-7L2E5YIM.cjs.map
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunk7L2E5YIM_cjs = require('./chunk-7L2E5YIM.cjs');
4
+ var unplugin = require('unplugin');
5
+
6
+ var webpack = unplugin.createWebpackPlugin(chunk7L2E5YIM_cjs.createUnpluginFactory("webpack"));
7
+ var webpack_default = webpack;
8
+
9
+ exports.webpack = webpack;
10
+ exports.webpack_default = webpack_default;
11
+ //# sourceMappingURL=chunk-CIMSOZYQ.cjs.map
12
+ //# sourceMappingURL=chunk-CIMSOZYQ.cjs.map
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMKIL6OVG_cjs = require('./chunk-MKIL6OVG.cjs');
4
- var chunkLFHXRRZX_cjs = require('./chunk-LFHXRRZX.cjs');
4
+ var chunk7L2E5YIM_cjs = require('./chunk-7L2E5YIM.cjs');
5
5
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
6
6
  var isUndefined = require('@stryke/type-checks/is-undefined');
7
7
  var unplugin = require('unplugin');
8
8
 
9
- var esbuild = unplugin.createEsbuildPlugin(chunkLFHXRRZX_cjs.createUnpluginFactory("esbuild", (api, plugin) => {
9
+ var esbuild = unplugin.createEsbuildPlugin(chunk7L2E5YIM_cjs.createUnpluginFactory("esbuild", (api, plugin) => {
10
10
  return {
11
11
  ...plugin,
12
12
  esbuild: {
@@ -32,5 +32,5 @@ var esbuild_default = esbuild;
32
32
 
33
33
  exports.esbuild = esbuild;
34
34
  exports.esbuild_default = esbuild_default;
35
- //# sourceMappingURL=chunk-QQ6V5SC5.cjs.map
36
- //# sourceMappingURL=chunk-QQ6V5SC5.cjs.map
35
+ //# sourceMappingURL=chunk-F3EMUOG6.cjs.map
36
+ //# sourceMappingURL=chunk-F3EMUOG6.cjs.map
@@ -1,5 +1,5 @@
1
1
  import { extractESBuildConfig } from './chunk-BNVPJWSG.js';
2
- import { createUnpluginFactory } from './chunk-5OE3ACWC.js';
2
+ import { createUnpluginFactory } from './chunk-UID2OOSN.js';
3
3
  import { __name } from './chunk-7QVYU63E.js';
4
4
  import { isDevelopmentMode, isTestMode } from '@stryke/env/environment-checks';
5
5
  import defu from 'defu';
@@ -151,5 +151,5 @@ var vite = createVitePlugin(createUnpluginFactory("vite", (api, plugin) => {
151
151
  var vite_default = vite;
152
152
 
153
153
  export { vite, vite_default };
154
- //# sourceMappingURL=chunk-PQOEG6WQ.js.map
155
- //# sourceMappingURL=chunk-PQOEG6WQ.js.map
154
+ //# sourceMappingURL=chunk-IUYN4H4X.js.map
155
+ //# sourceMappingURL=chunk-IUYN4H4X.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMKIL6OVG_cjs = require('./chunk-MKIL6OVG.cjs');
4
- var chunkLFHXRRZX_cjs = require('./chunk-LFHXRRZX.cjs');
4
+ var chunk7L2E5YIM_cjs = require('./chunk-7L2E5YIM.cjs');
5
5
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
6
6
  var environmentChecks = require('@stryke/env/environment-checks');
7
7
  var defu = require('defu');
@@ -97,7 +97,7 @@ function extractViteConfig(context) {
97
97
  chunkPK6SKIKE_cjs.__name(extractViteConfig, "extractViteConfig");
98
98
 
99
99
  // src/vite.ts
100
- var vite = unplugin.createVitePlugin(chunkLFHXRRZX_cjs.createUnpluginFactory("vite", (api, plugin) => {
100
+ var vite = unplugin.createVitePlugin(chunk7L2E5YIM_cjs.createUnpluginFactory("vite", (api, plugin) => {
101
101
  return {
102
102
  ...plugin,
103
103
  vite: {
@@ -158,5 +158,5 @@ var vite_default = vite;
158
158
 
159
159
  exports.vite = vite;
160
160
  exports.vite_default = vite_default;
161
- //# sourceMappingURL=chunk-BSKRKIB5.cjs.map
162
- //# sourceMappingURL=chunk-BSKRKIB5.cjs.map
161
+ //# sourceMappingURL=chunk-NPOQ26XB.cjs.map
162
+ //# sourceMappingURL=chunk-NPOQ26XB.cjs.map
@@ -1,6 +1,7 @@
1
1
  import { PLUGIN_NON_HOOK_FIELDS, PLUGIN_HOOKS_FIELDS } from './chunk-PQXP7XQK.js';
2
2
  import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from './chunk-NITQ5IYP.js';
3
3
  import { __name } from './chunk-7QVYU63E.js';
4
+ import { transformAsync } from '@babel/core';
4
5
  import { formatLogMessage } from '@storm-software/config-tools/logger/console';
5
6
  import { toArray } from '@stryke/convert/to-array';
6
7
  import { createDirectorySync, createDirectory } from '@stryke/fs/helpers';
@@ -23,6 +24,8 @@ import { isSetString } from '@stryke/type-checks/is-set-string';
23
24
  import { isString } from '@stryke/type-checks/is-string';
24
25
  import chalk5 from 'chalk';
25
26
  import Handlebars from 'handlebars';
27
+ import { declare } from '@babel/helper-plugin-utils';
28
+ import * as t from '@babel/types';
26
29
  import { isParentPath } from '@stryke/path/is-parent-path';
27
30
  import { prettyBytes } from '@stryke/string-format/pretty-bytes';
28
31
  import { InMemoryFileSystemHost, Project, DiagnosticCategory } from 'ts-morph';
@@ -78,9 +81,120 @@ import '@stryke/fs/remove-file';
78
81
 
79
82
  // package.json
80
83
  var name = "powerlines";
81
- var version = "0.37.55";
84
+ var version = "0.37.56";
82
85
  var package_default = {
83
86
  version};
87
+
88
+ // src/plugin-utils/modules.ts
89
+ function isBuiltinModule(context, moduleName) {
90
+ const prefix = context.config.output?.builtinPrefix || context.config?.framework || "powerlines";
91
+ return moduleName.startsWith(`${prefix.replace(/:$/, "")}:`) || Object.keys(context.fs.metadata).filter((key) => context.fs.metadata[key]?.type === "builtin").includes(moduleName);
92
+ }
93
+ __name(isBuiltinModule, "isBuiltinModule");
94
+
95
+ // src/internal/babel/module-resolver-plugin.ts
96
+ function resolveModulePath(nodePath, state) {
97
+ if (!t.isStringLiteral(nodePath.node) || !state.resolveAll && !isBuiltinModule(state.context, nodePath.node.value)) {
98
+ return;
99
+ }
100
+ const resolvedPath = state.context?.fs.resolveSync(nodePath.node.value);
101
+ if (resolvedPath) {
102
+ nodePath.replaceWith(t.stringLiteral(
103
+ // Remove the file extension if it exists
104
+ resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
105
+ ));
106
+ }
107
+ }
108
+ __name(resolveModulePath, "resolveModulePath");
109
+ var TRANSFORM_FUNCTIONS = [
110
+ "require",
111
+ "require.resolve",
112
+ "System.import",
113
+ // Jest methods
114
+ "jest.genMockFromModule",
115
+ "jest.mock",
116
+ "jest.unmock",
117
+ "jest.doMock",
118
+ // eslint-disable-next-line @cspell/spellchecker
119
+ "jest.dontMock",
120
+ "jest.setMock",
121
+ "jest.requireActual",
122
+ "jest.requireMock",
123
+ // Older Jest methods
124
+ "require.requireActual",
125
+ "require.requireMock"
126
+ ];
127
+ function matchesPattern(state, calleePath, pattern) {
128
+ const { node } = calleePath;
129
+ if (t.isMemberExpression(node)) {
130
+ return calleePath.matchesPattern(pattern);
131
+ }
132
+ if (!t.isIdentifier(node) || pattern.includes(".")) {
133
+ return false;
134
+ }
135
+ const name2 = pattern.split(".")[0];
136
+ return node.name === name2;
137
+ }
138
+ __name(matchesPattern, "matchesPattern");
139
+ var importVisitors = {
140
+ CallExpression: /* @__PURE__ */ __name((nodePath, state) => {
141
+ if (state.moduleResolverVisited.has(nodePath)) {
142
+ return;
143
+ }
144
+ const calleePath = nodePath.get("callee");
145
+ if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t.isImport(nodePath.node.callee)) {
146
+ state.moduleResolverVisited.add(nodePath);
147
+ resolveModulePath(nodePath.get("arguments.0"), state);
148
+ }
149
+ }, "CallExpression"),
150
+ // eslint-disable-next-line ts/naming-convention
151
+ "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ __name((nodePath, state) => {
152
+ if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
153
+ return;
154
+ }
155
+ state.moduleResolverVisited.add(nodePath);
156
+ resolveModulePath(nodePath.get("source"), state);
157
+ }, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
158
+ };
159
+ var moduleResolverBabelPlugin = /* @__PURE__ */ __name((context, options) => {
160
+ return declare(/* @__PURE__ */ __name(function builder(api) {
161
+ let moduleResolverVisited = /* @__PURE__ */ new Set();
162
+ return {
163
+ name: "powerlines:module-resolver",
164
+ manipulateOptions(opts) {
165
+ opts.filename ??= "unknown";
166
+ },
167
+ pre() {
168
+ moduleResolverVisited = /* @__PURE__ */ new Set();
169
+ },
170
+ visitor: {
171
+ Program: {
172
+ enter(programPath, state) {
173
+ programPath.traverse(importVisitors, {
174
+ ...state,
175
+ context,
176
+ moduleResolverVisited,
177
+ api,
178
+ resolveAll: options?.resolveAll ?? false
179
+ });
180
+ },
181
+ exit(programPath, state) {
182
+ programPath.traverse(importVisitors, {
183
+ ...state,
184
+ context,
185
+ moduleResolverVisited,
186
+ api,
187
+ resolveAll: options?.resolveAll ?? false
188
+ });
189
+ }
190
+ }
191
+ },
192
+ post() {
193
+ moduleResolverVisited.clear();
194
+ }
195
+ };
196
+ }, "builder"));
197
+ }, "moduleResolverBabelPlugin");
84
198
  var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
85
199
  static {
86
200
  __name(this, "VirtualFileSystemHost");
@@ -4370,6 +4484,39 @@ ${formatLogMessage({
4370
4484
  }
4371
4485
  context.debug("Transforming built-ins runtime modules files.");
4372
4486
  const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
4487
+ const result2 = await transformAsync(file.code.toString(), {
4488
+ highlightCode: true,
4489
+ code: true,
4490
+ ast: false,
4491
+ cloneInputAst: false,
4492
+ comments: true,
4493
+ sourceType: "module",
4494
+ configFile: false,
4495
+ babelrc: false,
4496
+ envName: context.config.mode,
4497
+ caller: {
4498
+ name: "powerlines"
4499
+ },
4500
+ ...context.config.transform.babel,
4501
+ filename: file.path,
4502
+ plugins: [
4503
+ [
4504
+ "@babel/plugin-syntax-typescript"
4505
+ ],
4506
+ [
4507
+ moduleResolverBabelPlugin(context)
4508
+ ]
4509
+ ]
4510
+ });
4511
+ if (!result2?.code) {
4512
+ throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
4513
+ }
4514
+ if (!file.id) {
4515
+ context.warn(`File ID is missing for a built-in runtime file at ${file.path}.`);
4516
+ file.id = replacePath(replacePath(file.path, context.workspaceConfig.workspaceRoot), context.builtinsPath);
4517
+ }
4518
+ context.trace(`Writing transformed built-in runtime file ${file.id}.`);
4519
+ await context.emitBuiltin(result2.code, file.id);
4373
4520
  return appendPath(file.path, context.builtinsPath);
4374
4521
  }));
4375
4522
  const typescriptPath = await resolvePackage("typescript");
@@ -4904,5 +5051,5 @@ Note: Please ensure the plugin package's default export is a class that extends
4904
5051
  };
4905
5052
 
4906
5053
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId, combineContexts, createLog, extendLog, isUnpluginBuilderVariant, name, version };
4907
- //# sourceMappingURL=chunk-L4OM5KXO.js.map
4908
- //# sourceMappingURL=chunk-L4OM5KXO.js.map
5054
+ //# sourceMappingURL=chunk-O5MRNC4W.js.map
5055
+ //# sourceMappingURL=chunk-O5MRNC4W.js.map
@@ -1,9 +1,9 @@
1
- import { createUnpluginFactory } from './chunk-5OE3ACWC.js';
1
+ import { createUnpluginFactory } from './chunk-UID2OOSN.js';
2
2
  import { createWebpackPlugin } from 'unplugin';
3
3
 
4
4
  var webpack = createWebpackPlugin(createUnpluginFactory("webpack"));
5
5
  var webpack_default = webpack;
6
6
 
7
7
  export { webpack, webpack_default };
8
- //# sourceMappingURL=chunk-7LH63BFW.js.map
9
- //# sourceMappingURL=chunk-7LH63BFW.js.map
8
+ //# sourceMappingURL=chunk-OVLE437L.js.map
9
+ //# sourceMappingURL=chunk-OVLE437L.js.map
@@ -1,4 +1,4 @@
1
- import { createLog, PowerlinesAPI } from './chunk-L4OM5KXO.js';
1
+ import { createLog, PowerlinesAPI } from './chunk-O5MRNC4W.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { LogLevelLabel } from '@storm-software/config-tools/types';
4
4
  import { getWorkspaceRoot } from '@stryke/fs/get-workspace-root';
@@ -134,5 +134,5 @@ function createUnpluginFactory(variant, decorate) {
134
134
  __name(createUnpluginFactory, "createUnpluginFactory");
135
135
 
136
136
  export { createUnpluginFactory, getString };
137
- //# sourceMappingURL=chunk-5OE3ACWC.js.map
138
- //# sourceMappingURL=chunk-5OE3ACWC.js.map
137
+ //# sourceMappingURL=chunk-UID2OOSN.js.map
138
+ //# sourceMappingURL=chunk-UID2OOSN.js.map
package/dist/esbuild.cjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var chunkQQ6V5SC5_cjs = require('./chunk-QQ6V5SC5.cjs');
5
+ var chunkF3EMUOG6_cjs = require('./chunk-F3EMUOG6.cjs');
6
6
  require('./chunk-MKIL6OVG.cjs');
7
- require('./chunk-LFHXRRZX.cjs');
8
- require('./chunk-2ESGIL56.cjs');
7
+ require('./chunk-7L2E5YIM.cjs');
8
+ require('./chunk-6GAEDFN4.cjs');
9
9
  require('./chunk-B6DVCLP5.cjs');
10
10
  require('./chunk-V5WOGN7O.cjs');
11
11
  require('./chunk-Z6ARQDHR.cjs');
@@ -15,15 +15,15 @@ require('./chunk-PK6SKIKE.cjs');
15
15
 
16
16
  Object.defineProperty(exports, "default", {
17
17
  enumerable: true,
18
- get: function () { return chunkQQ6V5SC5_cjs.esbuild_default; }
18
+ get: function () { return chunkF3EMUOG6_cjs.esbuild_default; }
19
19
  });
20
20
  Object.defineProperty(exports, "esbuild", {
21
21
  enumerable: true,
22
- get: function () { return chunkQQ6V5SC5_cjs.esbuild; }
22
+ get: function () { return chunkF3EMUOG6_cjs.esbuild; }
23
23
  });
24
24
  Object.defineProperty(exports, "module.exports", {
25
25
  enumerable: true,
26
- get: function () { return chunkQQ6V5SC5_cjs.esbuild; }
26
+ get: function () { return chunkF3EMUOG6_cjs.esbuild; }
27
27
  });
28
28
  //# sourceMappingURL=esbuild.cjs.map
29
29
  //# sourceMappingURL=esbuild.cjs.map