powerlines 0.30.0 → 0.30.2

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkYZ2NKI4K_cjs = require('../chunk-YZ2NKI4K.cjs');
4
- var chunkEXAOCEQF_cjs = require('../chunk-EXAOCEQF.cjs');
4
+ var chunkQNWZ35R2_cjs = require('../chunk-QNWZ35R2.cjs');
5
5
  var chunk4NBEK7BB_cjs = require('../chunk-4NBEK7BB.cjs');
6
6
  var chunkBQA4H72F_cjs = require('../chunk-BQA4H72F.cjs');
7
7
  var chunk7OO4SKFN_cjs = require('../chunk-7OO4SKFN.cjs');
@@ -22,19 +22,19 @@ Object.defineProperty(exports, "extractRspackConfig", {
22
22
  });
23
23
  Object.defineProperty(exports, "DEFAULT_TSDOWN_CONFIG", {
24
24
  enumerable: true,
25
- get: function () { return chunkEXAOCEQF_cjs.DEFAULT_TSDOWN_CONFIG; }
25
+ get: function () { return chunkQNWZ35R2_cjs.DEFAULT_TSDOWN_CONFIG; }
26
26
  });
27
27
  Object.defineProperty(exports, "extractTsdownConfig", {
28
28
  enumerable: true,
29
- get: function () { return chunkEXAOCEQF_cjs.extractTsdownConfig; }
29
+ get: function () { return chunkQNWZ35R2_cjs.extractTsdownConfig; }
30
30
  });
31
31
  Object.defineProperty(exports, "resolveFromTsdownFormat", {
32
32
  enumerable: true,
33
- get: function () { return chunkEXAOCEQF_cjs.resolveFromTsdownFormat; }
33
+ get: function () { return chunkQNWZ35R2_cjs.resolveFromTsdownFormat; }
34
34
  });
35
35
  Object.defineProperty(exports, "resolveTsdownFormat", {
36
36
  enumerable: true,
37
- get: function () { return chunkEXAOCEQF_cjs.resolveTsdownFormat; }
37
+ get: function () { return chunkQNWZ35R2_cjs.resolveTsdownFormat; }
38
38
  });
39
39
  Object.defineProperty(exports, "DEFAULT_TSUP_CONFIG", {
40
40
  enumerable: true,
@@ -1,5 +1,5 @@
1
1
  export { extractRspackConfig } from '../chunk-2IXO6SBG.js';
2
- export { DEFAULT_TSDOWN_CONFIG, extractTsdownConfig, resolveFromTsdownFormat, resolveTsdownFormat } from '../chunk-Q7C3YOFX.js';
2
+ export { DEFAULT_TSDOWN_CONFIG, extractTsdownConfig, resolveFromTsdownFormat, resolveTsdownFormat } from '../chunk-K4EXCL46.js';
3
3
  export { DEFAULT_TSUP_CONFIG, extractTsupConfig, resolveTsupEntry } from '../chunk-RTFLBGJI.js';
4
4
  export { DEFAULT_UNBUILD_CONFIG, extractUnbuildConfig, unbuildLoader } from '../chunk-SUABYS33.js';
5
5
  export { DEFAULT_VITE_CONFIG, extractViteConfig } from '../chunk-YFB6OGXJ.js';
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunkEXAOCEQF_cjs = require('../chunk-EXAOCEQF.cjs');
3
+ var chunkQNWZ35R2_cjs = require('../chunk-QNWZ35R2.cjs');
4
4
  require('../chunk-PK6SKIKE.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "DEFAULT_TSDOWN_CONFIG", {
9
9
  enumerable: true,
10
- get: function () { return chunkEXAOCEQF_cjs.DEFAULT_TSDOWN_CONFIG; }
10
+ get: function () { return chunkQNWZ35R2_cjs.DEFAULT_TSDOWN_CONFIG; }
11
11
  });
12
12
  Object.defineProperty(exports, "extractTsdownConfig", {
13
13
  enumerable: true,
14
- get: function () { return chunkEXAOCEQF_cjs.extractTsdownConfig; }
14
+ get: function () { return chunkQNWZ35R2_cjs.extractTsdownConfig; }
15
15
  });
16
16
  Object.defineProperty(exports, "resolveFromTsdownFormat", {
17
17
  enumerable: true,
18
- get: function () { return chunkEXAOCEQF_cjs.resolveFromTsdownFormat; }
18
+ get: function () { return chunkQNWZ35R2_cjs.resolveFromTsdownFormat; }
19
19
  });
20
20
  Object.defineProperty(exports, "resolveTsdownFormat", {
21
21
  enumerable: true,
22
- get: function () { return chunkEXAOCEQF_cjs.resolveTsdownFormat; }
22
+ get: function () { return chunkQNWZ35R2_cjs.resolveTsdownFormat; }
23
23
  });
24
24
  //# sourceMappingURL=tsdown.cjs.map
25
25
  //# sourceMappingURL=tsdown.cjs.map
@@ -1,4 +1,4 @@
1
- export { DEFAULT_TSDOWN_CONFIG, extractTsdownConfig, resolveFromTsdownFormat, resolveTsdownFormat } from '../chunk-Q7C3YOFX.js';
1
+ export { DEFAULT_TSDOWN_CONFIG, extractTsdownConfig, resolveFromTsdownFormat, resolveTsdownFormat } from '../chunk-K4EXCL46.js';
2
2
  import '../chunk-7QVYU63E.js';
3
3
  //# sourceMappingURL=tsdown.js.map
4
4
  //# sourceMappingURL=tsdown.js.map
@@ -4,6 +4,7 @@ import { toArray } from '@stryke/convert/to-array';
4
4
  import { omit } from '@stryke/helpers/omit';
5
5
  import { appendPath } from '@stryke/path/append';
6
6
  import { replacePath } from '@stryke/path/replace';
7
+ import { isSetString } from '@stryke/type-checks/is-set-string';
7
8
  import defu from 'defu';
8
9
 
9
10
  var DEFAULT_TSDOWN_CONFIG = {
@@ -12,6 +13,7 @@ var DEFAULT_TSDOWN_CONFIG = {
12
13
  minify: true,
13
14
  sourcemap: false,
14
15
  cjsDefault: true,
16
+ unbundle: true,
15
17
  dts: {
16
18
  parallel: true,
17
19
  newContext: true
@@ -31,7 +33,7 @@ function resolveTsdownFormat(formats) {
31
33
  return "iife";
32
34
  case "esm":
33
35
  default:
34
- return "esm";
36
+ return "es";
35
37
  }
36
38
  });
37
39
  }
@@ -54,13 +56,16 @@ function resolveFromTsdownFormat(formats) {
54
56
  });
55
57
  }
56
58
  __name(resolveFromTsdownFormat, "resolveFromTsdownFormat");
57
- var formatMessage = /* @__PURE__ */ __name((context, message) => message.replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim(), "formatMessage");
59
+ var formatMessage = /* @__PURE__ */ __name((context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim(), "formatMessage");
58
60
  function extractTsdownConfig(context) {
59
61
  return defu({
60
- entry: toArray(context.config.entry).map((entry) => {
62
+ entry: isSetString(context.config.entry) || Array.isArray(context.config.entry) && context.config.entry.length > 0 ? toArray(context.config.entry).map((entry) => {
61
63
  const typeDef = parseTypeDefinition(entry);
62
64
  return typeDef?.file;
63
- }).filter(Boolean),
65
+ }).filter(Boolean) : [
66
+ "src/**.ts",
67
+ "src/**/*.tsx"
68
+ ],
64
69
  alias: context.builtins.reduce((ret, id) => {
65
70
  const path = context.fs.ids[id];
66
71
  if (path) {
@@ -77,7 +82,7 @@ function extractTsdownConfig(context) {
77
82
  cwd: appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
78
83
  outDir: replacePath(appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot), appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot)),
79
84
  tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
80
- format: toArray(context.config.output.format).map((format) => format === "esm" ? "es" : format).filter(Boolean),
85
+ format: resolveTsdownFormat(context.config.output.format).filter(Boolean),
81
86
  mode: context.config.mode,
82
87
  treeshake: context.config.build.variant === "tsdown" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "esbuild" ? context.config.build?.treeShaking : void 0,
83
88
  minify: context.config.mode !== "development",
@@ -88,16 +93,16 @@ function extractTsdownConfig(context) {
88
93
  logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
89
94
  customLogger: {
90
95
  level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
91
- info: /* @__PURE__ */ __name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.info(formatMessage(context, message)), "info"),
92
- warn: /* @__PURE__ */ __name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.warn(formatMessage(context, message)), "warn"),
93
- warnOnce: /* @__PURE__ */ __name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.warn(formatMessage(context, message)), "warnOnce"),
94
- error: /* @__PURE__ */ __name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.error(formatMessage(context, message)), "error"),
95
- success: /* @__PURE__ */ __name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.info(formatMessage(context, message)), "success")
96
+ info: /* @__PURE__ */ __name((...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)), "info"),
97
+ warn: /* @__PURE__ */ __name((...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)), "warn"),
98
+ warnOnce: /* @__PURE__ */ __name((...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)), "warnOnce"),
99
+ error: /* @__PURE__ */ __name((...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)), "error"),
100
+ success: /* @__PURE__ */ __name((...msgs) => isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)), "success")
96
101
  }
97
102
  }, DEFAULT_TSDOWN_CONFIG);
98
103
  }
99
104
  __name(extractTsdownConfig, "extractTsdownConfig");
100
105
 
101
106
  export { DEFAULT_TSDOWN_CONFIG, extractTsdownConfig, resolveFromTsdownFormat, resolveTsdownFormat };
102
- //# sourceMappingURL=chunk-Q7C3YOFX.js.map
103
- //# sourceMappingURL=chunk-Q7C3YOFX.js.map
107
+ //# sourceMappingURL=chunk-K4EXCL46.js.map
108
+ //# sourceMappingURL=chunk-K4EXCL46.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/build/tsdown.ts"],"names":["DEFAULT_TSDOWN_CONFIG","platform","target","minify","sourcemap","cjsDefault","unbundle","dts","parallel","newContext","shims","silent","treeshake","fixedExtension","nodeProtocol","resolveTsdownFormat","formats","toArray","map","format","resolveFromTsdownFormat","formatMessage","context","msgs","filter","Boolean","join","replace","RegExp","config","name","trim","extractTsdownConfig","defu","entry","isSetString","Array","isArray","length","typeDef","parseTypeDefinition","file","alias","builtins","reduce","ret","id","path","fs","ids","noExternal","build","variant","override","omit","cwd","appendPath","projectRoot","workspaceConfig","workspaceRoot","outDir","replacePath","output","buildPath","tsconfig","tsconfigFilePath","mode","treeShaking","undefined","metafile","debug","logLevel","customLogger","level","info","warn","warnOnce","error","success"],"mappings":";;;;;;;;;AAmCO,IAAMA,qBAAAA,GAA4D;EACvEC,QAAAA,EAAU,SAAA;EACVC,MAAAA,EAAQ,QAAA;EACRC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,KAAA;EACXC,UAAAA,EAAY,IAAA;EACZC,QAAAA,EAAU,IAAA;EACVC,GAAAA,EAAK;IACHC,QAAAA,EAAU,IAAA;IACVC,UAAAA,EAAY;AACd,GAAA;EACAC,KAAAA,EAAO,IAAA;EACPC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,IAAA;EACXC,cAAAA,EAAgB,IAAA;EAChBC,YAAAA,EAAc;AAChB;AAQO,SAASC,oBACdC,OAAAA,EAA2B;AAE3B,EAAA,OAAOC,OAAAA,CAAQD,OAAAA,CAAAA,CAASE,GAAAA,CAAIC,CAAAA,MAAAA,KAAAA;AAC1B,IAAA,QAAQA,MAAAA;MACN,KAAK,KAAA;AACH,QAAA,OAAO,KAAA;MACT,KAAK,MAAA;AACH,QAAA,OAAO,MAAA;MACT,KAAK,KAAA;AACL,MAAA;AACE,QAAA,OAAO,IAAA;AACX;EACF,CAAA,CAAA;AACF;AAdgBJ,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA;AAsBT,SAASK,wBACdJ,OAAAA,EAAuC;AAEvC,EAAA,OAAOC,OAAAA,CAAQD,OAAAA,CAAAA,CAASE,GAAAA,CAAIC,CAAAA,MAAAA,KAAAA;AAC1B,IAAA,QAAQA,MAAAA;MACN,KAAK,KAA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AAcC,SAAAA,GAAYC,IAAAA,CAAAA,CAAAA,EAFhC,SAAA;AAGX;AACF,GAAA,EACAvB,qBAAAA,CAAAA;AAEJ;AAlGgBgC,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"chunk-K4EXCL46.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { Format as TsdownFormat } from \"tsdown\";\nimport {\n ESBuildBuildConfig,\n TsdownBuildConfig,\n TsdownResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<TsdownResolvedBuildConfig> = {\n platform: \"neutral\",\n target: \"esnext\",\n minify: true,\n sourcemap: false,\n cjsDefault: true,\n unbundle: true,\n dts: {\n parallel: true,\n newContext: true\n },\n shims: true,\n silent: true,\n treeshake: true,\n fixedExtension: true,\n nodeProtocol: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveTsdownFormat(\n formats?: Format | Format[]\n): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"es\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromTsdownFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function extractTsdownConfig(\n context: Context\n): TsdownResolvedBuildConfig {\n return defu(\n {\n entry:\n isSetString(context.config.entry) ||\n (Array.isArray(context.config.entry) && context.config.entry.length > 0)\n ? (toArray(context.config.entry)\n .map(entry => {\n const typeDef = parseTypeDefinition(entry);\n\n return typeDef?.file;\n })\n .filter(Boolean) as string[])\n : [\"src/**.ts\", \"src/**/*.tsx\"],\n alias: context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n noExternal: context.builtins\n },\n context.config.build.variant === \"tsdown\"\n ? context.config.build.override\n : {},\n context.config.build.variant === \"tsdown\"\n ? omit(context.config.build, [\"override\", \"variant\"])\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n ),\n outDir: replacePath(\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n )\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveTsdownFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake:\n context.config.build.variant === \"tsdown\"\n ? (context.config.build as TsdownBuildConfig)?.treeshake\n : context.config.build.variant === \"tsup\"\n ? (context.config.build as TsupBuildConfig)?.treeshake\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig)?.treeShaking\n : undefined,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.info(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.info(formatMessage(context, ...msgs))\n }\n } as TsdownResolvedBuildConfig,\n DEFAULT_TSDOWN_CONFIG\n );\n}\n"]}
@@ -6,6 +6,7 @@ var toArray = require('@stryke/convert/to-array');
6
6
  var omit = require('@stryke/helpers/omit');
7
7
  var append = require('@stryke/path/append');
8
8
  var replace = require('@stryke/path/replace');
9
+ var isSetString = require('@stryke/type-checks/is-set-string');
9
10
  var defu = require('defu');
10
11
 
11
12
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -18,6 +19,7 @@ var DEFAULT_TSDOWN_CONFIG = {
18
19
  minify: true,
19
20
  sourcemap: false,
20
21
  cjsDefault: true,
22
+ unbundle: true,
21
23
  dts: {
22
24
  parallel: true,
23
25
  newContext: true
@@ -37,7 +39,7 @@ function resolveTsdownFormat(formats) {
37
39
  return "iife";
38
40
  case "esm":
39
41
  default:
40
- return "esm";
42
+ return "es";
41
43
  }
42
44
  });
43
45
  }
@@ -60,13 +62,16 @@ function resolveFromTsdownFormat(formats) {
60
62
  });
61
63
  }
62
64
  chunkPK6SKIKE_cjs.__name(resolveFromTsdownFormat, "resolveFromTsdownFormat");
63
- var formatMessage = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context, message) => message.replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim(), "formatMessage");
65
+ var formatMessage = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context, ...msgs) => msgs.filter(Boolean).join(" ").replace(new RegExp(`\\[${context.config.name}\\]`, "g"), "").trim(), "formatMessage");
64
66
  function extractTsdownConfig(context) {
65
67
  return defu__default.default({
66
- entry: toArray.toArray(context.config.entry).map((entry) => {
68
+ entry: isSetString.isSetString(context.config.entry) || Array.isArray(context.config.entry) && context.config.entry.length > 0 ? toArray.toArray(context.config.entry).map((entry) => {
67
69
  const typeDef = parseTypeDefinition.parseTypeDefinition(entry);
68
70
  return typeDef?.file;
69
- }).filter(Boolean),
71
+ }).filter(Boolean) : [
72
+ "src/**.ts",
73
+ "src/**/*.tsx"
74
+ ],
70
75
  alias: context.builtins.reduce((ret, id) => {
71
76
  const path = context.fs.ids[id];
72
77
  if (path) {
@@ -83,7 +88,7 @@ function extractTsdownConfig(context) {
83
88
  cwd: append.appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot),
84
89
  outDir: replace.replacePath(append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot), append.appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot)),
85
90
  tsconfig: append.appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
86
- format: toArray.toArray(context.config.output.format).map((format) => format === "esm" ? "es" : format).filter(Boolean),
91
+ format: resolveTsdownFormat(context.config.output.format).filter(Boolean),
87
92
  mode: context.config.mode,
88
93
  treeshake: context.config.build.variant === "tsdown" ? context.config.build?.treeshake : context.config.build.variant === "tsup" ? context.config.build?.treeshake : context.config.build.variant === "esbuild" ? context.config.build?.treeShaking : void 0,
89
94
  minify: context.config.mode !== "development",
@@ -94,11 +99,11 @@ function extractTsdownConfig(context) {
94
99
  logLevel: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
95
100
  customLogger: {
96
101
  level: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
97
- info: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.info(formatMessage(context, message)), "info"),
98
- warn: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.warn(formatMessage(context, message)), "warn"),
99
- warnOnce: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.warn(formatMessage(context, message)), "warnOnce"),
100
- error: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.error(formatMessage(context, message)), "error"),
101
- success: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => formatMessage(context, message).replace(/\s+/g, "").length > 5 && context.info(formatMessage(context, message)), "success")
102
+ info: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((...msgs) => isSetString.isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)), "info"),
103
+ warn: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((...msgs) => isSetString.isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)), "warn"),
104
+ warnOnce: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((...msgs) => isSetString.isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.warn(formatMessage(context, ...msgs)), "warnOnce"),
105
+ error: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((...msgs) => isSetString.isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.error(formatMessage(context, ...msgs)), "error"),
106
+ success: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((...msgs) => isSetString.isSetString(formatMessage(context, ...msgs).replace(/\s+/g, "")) && context.info(formatMessage(context, ...msgs)), "success")
102
107
  }
103
108
  }, DEFAULT_TSDOWN_CONFIG);
104
109
  }
@@ -108,5 +113,5 @@ exports.DEFAULT_TSDOWN_CONFIG = DEFAULT_TSDOWN_CONFIG;
108
113
  exports.extractTsdownConfig = extractTsdownConfig;
109
114
  exports.resolveFromTsdownFormat = resolveFromTsdownFormat;
110
115
  exports.resolveTsdownFormat = resolveTsdownFormat;
111
- //# sourceMappingURL=chunk-EXAOCEQF.cjs.map
112
- //# sourceMappingURL=chunk-EXAOCEQF.cjs.map
116
+ //# sourceMappingURL=chunk-QNWZ35R2.cjs.map
117
+ //# sourceMappingURL=chunk-QNWZ35R2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/build/tsdown.ts"],"names":["DEFAULT_TSDOWN_CONFIG","platform","target","minify","sourcemap","cjsDefault","unbundle","dts","parallel","newContext","shims","silent","treeshake","fixedExtension","nodeProtocol","resolveTsdownFormat","formats","toArray","map","format","resolveFromTsdownFormat","formatMessage","__name","context","msgs","filter","Boolean","join","replace","RegExp","config","name","trim","extractTsdownConfig","defu","entry","isSetString","Array","isArray","length","typeDef","parseTypeDefinition","file","alias","builtins","reduce","ret","id","path","fs","ids","noExternal","build","variant","override","omit","cwd","appendPath","projectRoot","workspaceConfig","workspaceRoot","outDir","replacePath","output","buildPath","tsconfig","tsconfigFilePath","mode","treeShaking","undefined","metafile","debug","logLevel","customLogger","level","info","warn","warnOnce","error","success"],"mappings":";;;;;;;;;;;;;;;AAmCO,IAAMA,qBAAAA,GAA4D;EACvEC,QAAAA,EAAU,SAAA;EACVC,MAAAA,EAAQ,QAAA;EACRC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,KAAA;EACXC,UAAAA,EAAY,IAAA;EACZC,QAAAA,EAAU,IAAA;EACVC,GAAAA,EAAK;IACHC,QAAAA,EAAU,IAAA;IACVC,UAAAA,EAAY;AACd,GAAA;EACAC,KAAAA,EAAO,IAAA;EACPC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,IAAA;EACXC,cAAAA,EAAgB,IAAA;EAChBC,YAAAA,EAAc;AAChB;AAQO,SAASC,oBACdC,OAAAA,EAA2B;AAE3B,EAAA,OAAOC,eAAAA,CAAQD,OAAAA,CAAAA,CAASE,GAAAA,CAAIC,CAAAA,MAAAA,KAAAA;AAC1B,IAAA,QAAQA,MAAAA;MACN,KAAK,KAAA;AACH,QAAA,OAAO,KAAA;MACT,KAAK,MAAA;AACH,QAAA,OAAO,MAAA;MACT,KAAK,KAAA;AACL,MAAA;AACE,QAAA,OAAO,IAAA;AACX;EACF,CAAA,CAAA;AACF;AAdgBJ,wBAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA;AAsBT,SAASK,wBACdJ,OAAAA,EAAuC;AAEvC,EAAA,OAAOC,eAAAA,CAAQD,OAAAA,CAAAA,CAASE,GAAAA,CAAIC,CAAAA,MAAAA,KAAAA;AAC1B,IAAA,QAAQA,MAAAA;MACN,KAAK,KAAA;MACL,KAAK,UAAA;AACH,QAAA,OAAO,KAAA;MACT,KAAK,MAAA;AACH,QAAA,OAAO,MAAA;MACT,KAAK,KAAA;MACL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AA,EACAxB,qBAAAA,CAAAA;AAEJ;AAlGgBiC,wBAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"chunk-QNWZ35R2.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { Format as TsdownFormat } from \"tsdown\";\nimport {\n ESBuildBuildConfig,\n TsdownBuildConfig,\n TsdownResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<TsdownResolvedBuildConfig> = {\n platform: \"neutral\",\n target: \"esnext\",\n minify: true,\n sourcemap: false,\n cjsDefault: true,\n unbundle: true,\n dts: {\n parallel: true,\n newContext: true\n },\n shims: true,\n silent: true,\n treeshake: true,\n fixedExtension: true,\n nodeProtocol: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveTsdownFormat(\n formats?: Format | Format[]\n): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"es\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromTsdownFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function extractTsdownConfig(\n context: Context\n): TsdownResolvedBuildConfig {\n return defu(\n {\n entry:\n isSetString(context.config.entry) ||\n (Array.isArray(context.config.entry) && context.config.entry.length > 0)\n ? (toArray(context.config.entry)\n .map(entry => {\n const typeDef = parseTypeDefinition(entry);\n\n return typeDef?.file;\n })\n .filter(Boolean) as string[])\n : [\"src/**.ts\", \"src/**/*.tsx\"],\n alias: context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n noExternal: context.builtins\n },\n context.config.build.variant === \"tsdown\"\n ? context.config.build.override\n : {},\n context.config.build.variant === \"tsdown\"\n ? omit(context.config.build, [\"override\", \"variant\"])\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n ),\n outDir: replacePath(\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n )\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveTsdownFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake:\n context.config.build.variant === \"tsdown\"\n ? (context.config.build as TsdownBuildConfig)?.treeshake\n : context.config.build.variant === \"tsup\"\n ? (context.config.build as TsupBuildConfig)?.treeshake\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig)?.treeShaking\n : undefined,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.info(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.info(formatMessage(context, ...msgs))\n }\n } as TsdownResolvedBuildConfig,\n DEFAULT_TSDOWN_CONFIG\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerlines",
3
- "version": "0.30.0",
3
+ "version": "0.30.2",
4
4
  "type": "module",
5
5
  "description": "The \"any framework\" framework that simplifies modern dev tool usage, generates virtual (or actual) code modules, and improves DX across the board.",
6
6
  "repository": {
@@ -570,12 +570,12 @@
570
570
  "@rollup/plugin-inject": "^5.0.5",
571
571
  "@rollup/plugin-node-resolve": "^16.0.3",
572
572
  "@rollup/plugin-replace": "^6.0.3",
573
- "@storm-software/build-tools": "^0.158.52",
574
- "@storm-software/config": "^1.134.52",
575
- "@storm-software/config-tools": "^1.188.52",
576
- "@storm-software/esbuild": "^0.53.52",
577
- "@storm-software/tsup": "^0.2.50",
578
- "@storm-software/unbuild": "^0.57.52",
573
+ "@storm-software/build-tools": "^0.158.53",
574
+ "@storm-software/config": "^1.134.53",
575
+ "@storm-software/config-tools": "^1.188.53",
576
+ "@storm-software/esbuild": "^0.53.53",
577
+ "@storm-software/tsup": "^0.2.51",
578
+ "@storm-software/unbuild": "^0.57.53",
579
579
  "@stryke/capnp": "^0.12.33",
580
580
  "@stryke/convert": "^0.6.13",
581
581
  "@stryke/env": "^0.20.26",
@@ -613,7 +613,7 @@
613
613
  },
614
614
  "devDependencies": {
615
615
  "@microsoft/tsdoc": "^0.15.1",
616
- "@storm-software/testing-tools": "^1.119.52",
616
+ "@storm-software/testing-tools": "^1.119.53",
617
617
  "@stryke/types": "^0.10.13",
618
618
  "@types/babel__core": "^7.20.5",
619
619
  "@types/babel__helper-module-imports": "^7.18.3",
@@ -631,5 +631,5 @@
631
631
  "undici-types": "^7.16.0"
632
632
  },
633
633
  "publishConfig": { "access": "public" },
634
- "gitHead": "f0a4e1526773f5d4bfb63fd5ba1d02d5aa9bc771"
634
+ "gitHead": "cac32f77cda8960ceaf2645f04f2c88f16eb4aae"
635
635
  }
@@ -1,292 +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
- import type { ConfigAPI, NodePath, types as t } from "@babel/core";
20
- import type { HubInterface } from "@babel/traverse";
21
-
22
- declare module "@babel/helper-plugin-utils" {
23
- const knownAssumptions: readonly [
24
- "arrayLikeIsIterable",
25
- "constantReexports",
26
- "constantSuper",
27
- "enumerableModuleMeta",
28
- "ignoreFunctionLength",
29
- "ignoreToPrimitiveHint",
30
- "iterableIsArray",
31
- "mutableTemplateObject",
32
- "noClassCalls",
33
- "noDocumentAll",
34
- "noIncompleteNsImportDetection",
35
- "noNewArrows",
36
- "noUninitializedPrivateFieldAccess",
37
- "objectRestNoSymbols",
38
- "privateFieldsAsSymbols",
39
- "privateFieldsAsProperties",
40
- "pureGetters",
41
- "setClassMethods",
42
- "setComputedProperties",
43
- "setPublicClassFields",
44
- "setSpreadProperties",
45
- "skipForOfIteratorClosing",
46
- "superIsCallableConstructor"
47
- ];
48
-
49
- export type AssumptionName = (typeof knownAssumptions)[number];
50
-
51
- type AssumptionFunction = (name: AssumptionName) => boolean | undefined;
52
-
53
- export type Target =
54
- | "node"
55
- | "deno"
56
- | "chrome"
57
- | "opera"
58
- | "edge"
59
- | "firefox"
60
- | "safari"
61
- | "ie"
62
- | "ios"
63
- | "android"
64
- | "electron"
65
- | "samsung"
66
- | "opera_mobile";
67
-
68
- export type Targets = {
69
- [target in Target]?: string;
70
- };
71
-
72
- type TargetsFunction = () => Targets;
73
-
74
- export type PresetAPI = {
75
- targets: TargetsFunction;
76
- addExternalDependency: (ref: string) => void;
77
- } & ConfigAPI;
78
-
79
- export type PluginAPI = {
80
- assumption: AssumptionFunction;
81
- } & PresetAPI &
82
- BabelAPI;
83
- }
84
-
85
- declare module "@babel/core" {
86
- export interface BabelFile
87
- extends HubInterface,
88
- Pick<PluginPass, "get" | "set"> {}
89
- }
90
-
91
- declare module "@babel/helper-module-transforms" {
92
- interface LocalExportMetadata {
93
- /**
94
- * names of exports
95
- */
96
- names: string[];
97
- kind: "import" | "hoisted" | "block" | "var";
98
- }
99
-
100
- type InteropType =
101
- /**
102
- * Babel interop for default-only imports
103
- */
104
- | "default"
105
- /**
106
- * Babel interop for namespace or default+named imports
107
- */
108
- | "namespace"
109
- /**
110
- * Node.js interop for default-only imports
111
- */
112
- | "node-default"
113
- /**
114
- * Node.js interop for namespace or default+named imports
115
- */
116
- | "node-namespace"
117
- /**
118
- * No interop, or named-only imports
119
- */
120
- | "none";
121
-
122
- interface SourceModuleMetadata {
123
- /**
124
- * A unique variable name to use for this namespace object.
125
- * Centralized for simplicity.
126
- */
127
- name: string;
128
- loc: t.SourceLocation | undefined | null;
129
- interop: InteropType;
130
- /**
131
- * Local binding to reference from this source namespace.
132
- * Key: Local name, value: Import name
133
- */
134
- imports: Map<string, string>;
135
- /**
136
- * Local names that reference namespace object.
137
- */
138
- importsNamespace: Set<string>;
139
- /**
140
- * Reexports to create for namespace. Key: Export name, value: Import name
141
- */
142
- reexports: Map<string, string>;
143
- /**
144
- * List of names to re-export namespace as.
145
- */
146
- reexportNamespace: Set<string>;
147
- /**
148
- * Tracks if the source should be re-exported.
149
- */
150
- reexportAll: null | {
151
- loc: t.SourceLocation | undefined | null;
152
- };
153
- wrap?: unknown;
154
- referenced: boolean;
155
- }
156
-
157
- interface ModuleMetadata {
158
- exportName: string;
159
- /**
160
- * The name of the variable that will reference an object
161
- * containing export names.
162
- */
163
- exportNameListName: null | string;
164
- hasExports: boolean;
165
- /**
166
- * Lookup from local binding to export information.
167
- */
168
- local: Map<string, LocalExportMetadata>;
169
- /**
170
- * Lookup of source file to source file metadata.
171
- */
172
- source: Map<string, SourceModuleMetadata>;
173
- /**
174
- * List of names that should only be printed as string literals.
175
- * i.e. `import { "any unicode" as foo } from "some-module"`
176
- * `stringSpecifiers` is `Set(1) ["any unicode"]`
177
- * In most cases `stringSpecifiers` is an empty Set
178
- */
179
- stringSpecifiers: Set<string>;
180
- }
181
-
182
- type ImportInterop =
183
- | "none"
184
- | "babel"
185
- | "node"
186
- | ((source: string, filename?: string) => "none" | "babel" | "node");
187
-
188
- type Lazy = boolean | string[] | ((source: string) => boolean);
189
-
190
- interface RootOptions {
191
- filename?: string | null;
192
- filenameRelative?: string | null;
193
- sourceRoot?: string | null;
194
- }
195
-
196
- export interface PluginOptions {
197
- moduleId?: string;
198
- moduleIds?: boolean;
199
- getModuleId?: (moduleName: string) => string | null | undefined;
200
- moduleRoot?: string;
201
- }
202
-
203
- export function getModuleName(
204
- rootOpts: RootOptions,
205
- pluginOpts: PluginOptions
206
- ): string | null;
207
-
208
- export interface RewriteModuleStatementsAndPrepareHeaderOptions {
209
- exportName?: string;
210
- strict?: boolean;
211
- allowTopLevelThis?: boolean;
212
- strictMode?: boolean;
213
- loose?: boolean;
214
- importInterop?: ImportInterop;
215
- noInterop?: boolean;
216
- lazy?: Lazy;
217
- getWrapperPayload?: (
218
- source: string,
219
- metadata: SourceModuleMetadata,
220
- importNodes: t.Node[]
221
- ) => unknown;
222
- wrapReference?: (
223
- ref: t.Expression,
224
- payload: unknown
225
- ) => t.Expression | null | undefined;
226
- esNamespaceOnly?: boolean;
227
- filename: string | undefined | null;
228
- constantReexports?: boolean | void;
229
- enumerableModuleMeta?: boolean | void;
230
- noIncompleteNsImportDetection?: boolean | void;
231
- }
232
-
233
- /**
234
- * Perform all of the generic ES6 module rewriting needed to handle initial
235
- * module processing. This function will rewrite the majority of the given
236
- * program to reference the modules described by the returned metadata,
237
- * and returns a list of statements for use when initializing the module.
238
- */
239
- export function rewriteModuleStatementsAndPrepareHeader(
240
- path: NodePath<t.Program>,
241
- options: RewriteModuleStatementsAndPrepareHeaderOptions
242
- ): {
243
- meta: ModuleMetadata;
244
- headers: t.Statement[];
245
- };
246
-
247
- /**
248
- * Check if a given source is an anonymous import, e.g. `import 'foo';`
249
- */
250
- export function isSideEffectImport(source: SourceModuleMetadata): boolean;
251
-
252
- /**
253
- * Create the runtime initialization statements for a given requested source.
254
- * These will initialize all of the runtime import/export logic that
255
- * can't be handled statically by the statements created by
256
- * `buildExportInitializationStatements()`.
257
- */
258
- export function buildNamespaceInitStatements(
259
- metadata: ModuleMetadata,
260
- sourceMetadata: SourceModuleMetadata,
261
- constantReexports?: boolean | void,
262
- wrapReference?: (
263
- ref: t.Identifier,
264
- payload: unknown
265
- ) => t.Expression | null | undefined
266
- ): t.Statement[];
267
-
268
- /**
269
- * Flag a set of statements as hoisted above all else so that module init
270
- * statements all run before user code.
271
- */
272
- export function ensureStatementsHoisted(statements: t.Statement[]): void;
273
-
274
- /**
275
- * Given an expression for a standard import object, like `require('foo')`,
276
- * wrap it in a call to the interop helpers based on the type.
277
- */
278
- export function wrapInterop(
279
- programPath: NodePath<t.Program>,
280
- expr: t.Expression,
281
- type: InteropType
282
- ): t.CallExpression;
283
-
284
- export function buildDynamicImport(
285
- node: t.CallExpression | t.ImportExpression,
286
- deferToThen: boolean,
287
- wrapWithPromise: boolean,
288
- builder: (specifier: t.Expression) => t.Expression
289
- ): t.Expression;
290
- }
291
-
292
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/build/tsdown.ts"],"names":["DEFAULT_TSDOWN_CONFIG","platform","target","minify","sourcemap","cjsDefault","dts","parallel","newContext","shims","silent","treeshake","fixedExtension","nodeProtocol","resolveTsdownFormat","formats","toArray","map","format","resolveFromTsdownFormat","formatMessage","__name","context","message","replace","RegExp","config","name","trim","extractTsdownConfig","defu","entry","typeDef","parseTypeDefinition","file","filter","Boolean","alias","builtins","reduce","ret","id","path","fs","ids","noExternal","build","variant","override","omit","cwd","appendPath","projectRoot","workspaceConfig","workspaceRoot","outDir","replacePath","output","buildPath","tsconfig","tsconfigFilePath","mode","treeShaking","undefined","metafile","debug","logLevel","customLogger","level","info","length","warn","warnOnce","error","success"],"mappings":";;;;;;;;;;;;;;AAkCO,IAAMA,qBAAAA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ASC,QAAQ,MAAA,EAAQ,EAAA,CAAA,CAAI8C,MAAAA,GAAS,KAC7DhD,OAAAA,CAAQiD,IAAAA,CAAKnD,cAAcE,OAAAA,EAASC,OAAAA,CAAAA,CAAAA,EAF5B,UAAA,CAAA;AAGVkD,MAAAA,KAAAA,4CAAQlD,OAAAA,KACNH,aAAAA,CAAcE,SAASC,OAAAA,CAAAA,CAASC,QAAQ,MAAA,EAAQ,EAAA,CAAA,CAAI8C,MAAAA,GAAS,KAC7DhD,OAAAA,CAAQmD,KAAAA,CAAMrD,cAAcE,OAAAA,EAASC,OAAAA,CAAAA,CAAAA,EAFhC,OAAA,CAAA;AAGPmD,MAAAA,OAAAA,4CAAUnD,OAAAA,KACRH,aAAAA,CAAcE,SAASC,OAAAA,CAAAA,CAASC,QAAQ,MAAA,EAAQ,EAAA,CAAA,CAAI8C,MAAAA,GAAS,KAC7DhD,OAAAA,CAAQ+C,IAAAA,CAAKjD,cAAcE,OAAAA,EAASC,OAAAA,CAAAA,CAAAA,EAF7B,SAAA;AAGX;AACF,GAAA,EACAvB,qBAAAA,CAAAA;AAEJ;AAhGgB6B,wBAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"chunk-EXAOCEQF.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { Format as TsdownFormat } from \"tsdown\";\nimport {\n ESBuildBuildConfig,\n TsdownBuildConfig,\n TsdownResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<TsdownResolvedBuildConfig> = {\n platform: \"neutral\",\n target: \"esnext\",\n minify: true,\n sourcemap: false,\n cjsDefault: true,\n dts: {\n parallel: true,\n newContext: true\n },\n shims: true,\n silent: true,\n treeshake: true,\n fixedExtension: true,\n nodeProtocol: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveTsdownFormat(\n formats?: Format | Format[]\n): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromTsdownFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, message: string) =>\n message.replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\").trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function extractTsdownConfig(\n context: Context\n): TsdownResolvedBuildConfig {\n return defu(\n {\n entry: toArray(context.config.entry)\n .map(entry => {\n const typeDef = parseTypeDefinition(entry);\n\n return typeDef?.file;\n })\n .filter(Boolean) as string[],\n alias: context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n noExternal: context.builtins\n },\n context.config.build.variant === \"tsdown\"\n ? context.config.build.override\n : {},\n context.config.build.variant === \"tsdown\"\n ? omit(context.config.build, [\"override\", \"variant\"])\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n ),\n outDir: replacePath(\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n )\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: toArray(context.config.output.format)\n .map(format => (format === \"esm\" ? \"es\" : format))\n .filter(Boolean) as TsdownFormat[],\n mode: context.config.mode,\n treeshake:\n context.config.build.variant === \"tsdown\"\n ? (context.config.build as TsdownBuildConfig)?.treeshake\n : context.config.build.variant === \"tsup\"\n ? (context.config.build as TsupBuildConfig)?.treeshake\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig)?.treeShaking\n : undefined,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.info(formatMessage(context, message)),\n warn: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.warn(formatMessage(context, message)),\n warnOnce: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.warn(formatMessage(context, message)),\n error: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.error(formatMessage(context, message)),\n success: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.info(formatMessage(context, message))\n }\n } as TsdownResolvedBuildConfig,\n DEFAULT_TSDOWN_CONFIG\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/build/tsdown.ts"],"names":["DEFAULT_TSDOWN_CONFIG","platform","target","minify","sourcemap","cjsDefault","dts","parallel","newContext","shims","silent","treeshake","fixedExtension","nodeProtocol","resolveTsdownFormat","formats","toArray","map","format","resolveFromTsdownFormat","formatMessage","context","message","replace","RegExp","config","name","trim","extractTsdownConfig","defu","entry","typeDef","parseTypeDefinition","file","filter","Boolean","alias","builtins","reduce","ret","id","path","fs","ids","noExternal","build","variant","override","omit","cwd","appendPath","projectRoot","workspaceConfig","workspaceRoot","outDir","replacePath","output","buildPath","tsconfig","tsconfigFilePath","mode","treeShaking","undefined","metafile","debug","logLevel","customLogger","level","info","length","warn","warnOnce","error","success"],"mappings":";;;;;;;;AAkCO,IAAMA,qBAAAA,GAA4D;EACvEC,QAAAA,EAAU,SAAA;EACVC,MAAAA,EAAQ,QAAA;EACRC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,KAAA;EACXC,UAAAA,EAAY,IAAA;EACZC,GAAAA,EAAK;IACHC,QAAAA,EAAU,IAAA;IACVC,UAAAA,EAAY;AACd,GAAA;EACAC,KAAAA,EAAO,IAAA;EACPC,MAAAA,EAAQ,IAAA;EACRC,SAAAA,EAAW,IAAA;EACXC,cAAAA,EAAgB,IAAA;EAChBC,YAAAA,EAAc;AAChB;AAQO,SAASC,oBACdC,OAAAA,EAA2B;AAE3B,EAAA,OAAOC,OAAAA,CAAQD,OAAAA,CAAAA,CAASE,GAAAA,CAAIC,CAAAA,MAAAA,KAAA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AAA,CAASC,QAAQ,MAAA,EAAQ,EAAA,CAAA,CAAI8C,MAAAA,GAAS,KAC7DhD,OAAAA,CAAQ+C,IAAAA,CAAKhD,cAAcC,OAAAA,EAASC,OAAAA,CAAAA,CAAAA,EAF7B,SAAA;AAGX;AACF,GAAA,EACAtB,qBAAAA,CAAAA;AAEJ;AAhGgB4B,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"chunk-Q7C3YOFX.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { Format as TsdownFormat } from \"tsdown\";\nimport {\n ESBuildBuildConfig,\n TsdownBuildConfig,\n TsdownResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<TsdownResolvedBuildConfig> = {\n platform: \"neutral\",\n target: \"esnext\",\n minify: true,\n sourcemap: false,\n cjsDefault: true,\n dts: {\n parallel: true,\n newContext: true\n },\n shims: true,\n silent: true,\n treeshake: true,\n fixedExtension: true,\n nodeProtocol: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveTsdownFormat(\n formats?: Format | Format[]\n): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromTsdownFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = (context: Context, message: string) =>\n message.replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\").trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function extractTsdownConfig(\n context: Context\n): TsdownResolvedBuildConfig {\n return defu(\n {\n entry: toArray(context.config.entry)\n .map(entry => {\n const typeDef = parseTypeDefinition(entry);\n\n return typeDef?.file;\n })\n .filter(Boolean) as string[],\n alias: context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n noExternal: context.builtins\n },\n context.config.build.variant === \"tsdown\"\n ? context.config.build.override\n : {},\n context.config.build.variant === \"tsdown\"\n ? omit(context.config.build, [\"override\", \"variant\"])\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n ),\n outDir: replacePath(\n appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.projectRoot,\n context.workspaceConfig.workspaceRoot\n )\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: toArray(context.config.output.format)\n .map(format => (format === \"esm\" ? \"es\" : format))\n .filter(Boolean) as TsdownFormat[],\n mode: context.config.mode,\n treeshake:\n context.config.build.variant === \"tsdown\"\n ? (context.config.build as TsdownBuildConfig)?.treeshake\n : context.config.build.variant === \"tsup\"\n ? (context.config.build as TsupBuildConfig)?.treeshake\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig)?.treeShaking\n : undefined,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.info(formatMessage(context, message)),\n warn: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.warn(formatMessage(context, message)),\n warnOnce: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.warn(formatMessage(context, message)),\n error: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.error(formatMessage(context, message)),\n success: (message: string) =>\n formatMessage(context, message).replace(/\\s+/g, \"\").length > 5 &&\n context.info(formatMessage(context, message))\n }\n } as TsdownResolvedBuildConfig,\n DEFAULT_TSDOWN_CONFIG\n );\n}\n"]}