@storm-software/unbuild 0.30.6 → 0.31.1

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.
@@ -54,10 +54,154 @@ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_reso
54
54
 
55
55
 
56
56
  // ../build-tools/src/utilities/copy-assets.ts
57
-
58
-
57
+ var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
59
58
  var _glob = require('glob');
60
59
  var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
60
+ var copyAssets = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
61
+ const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
62
+ pendingAssets.push({
63
+ input: projectRoot,
64
+ glob: "*.md",
65
+ output: "."
66
+ });
67
+ pendingAssets.push({
68
+ input: ".",
69
+ glob: "LICENSE",
70
+ output: "."
71
+ });
72
+ if (generatePackageJson2 === false) {
73
+ pendingAssets.push({
74
+ input: projectRoot,
75
+ glob: "package.json",
76
+ output: "."
77
+ });
78
+ }
79
+ if (includeSrc === true) {
80
+ pendingAssets.push({
81
+ input: sourceRoot,
82
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
83
+ output: "src/"
84
+ });
85
+ }
86
+ _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
87
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
88
+ const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
89
+ projectDir: projectRoot,
90
+ rootDir: config.workspaceRoot,
91
+ outputDir: outputPath,
92
+ assets: pendingAssets
93
+ });
94
+ await assetHandler.processAllAssetsOnce();
95
+ if (includeSrc === true) {
96
+ _chunkLXCK6Y4Ccjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, "src")}`, config);
97
+ const files = await _glob.glob.call(void 0, [
98
+ _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
99
+ _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
100
+ _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
101
+ _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
102
+ ]);
103
+ await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
104
+
105
+ ${await _promises.readFile.call(void 0, file, "utf8")}
106
+
107
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
108
+ }
109
+ }, "copyAssets");
110
+
111
+ // ../build-tools/src/utilities/generate-package-json.ts
112
+
113
+
114
+
115
+
116
+ var _projectgraph = require('nx/src/project-graph/project-graph');
117
+ var addPackageDependencies = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
118
+ const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
119
+ const localPackages = [];
120
+ for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
121
+ const projectNode = project.node;
122
+ if (projectNode.data.root) {
123
+ const projectPackageJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
124
+ if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
125
+ const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
126
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
127
+ if (projectPackageJson.private !== false) {
128
+ localPackages.push(projectPackageJson);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ if (localPackages.length > 0) {
134
+ _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
135
+ packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
136
+ if (!ret[localPackage.name]) {
137
+ ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
138
+ }
139
+ return ret;
140
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
141
+ packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
142
+ if (!ret[localPackage.name]) {
143
+ ret[localPackage.name] = {
144
+ optional: false
145
+ };
146
+ }
147
+ return ret;
148
+ }, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
149
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
150
+ if (!ret[localPackage.name]) {
151
+ ret[localPackage.name] = localPackage.version || "0.0.1";
152
+ }
153
+ return ret;
154
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
155
+ } else {
156
+ _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
157
+ }
158
+ return packageJson;
159
+ }, "addPackageDependencies");
160
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
161
+ const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, );
162
+ const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
163
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
164
+ packageJson.type ??= "module";
165
+ packageJson.sideEffects ??= false;
166
+ if (includeSrc === true) {
167
+ let distSrc = sourceRoot.replace(projectRoot, "");
168
+ if (distSrc.startsWith("/")) {
169
+ distSrc = distSrc.substring(1);
170
+ }
171
+ packageJson.source ??= `${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
172
+ }
173
+ packageJson.files ??= [
174
+ "dist/**/*"
175
+ ];
176
+ if (includeSrc === true && !packageJson.files.includes("src")) {
177
+ packageJson.files.push("src/**/*");
178
+ }
179
+ packageJson.publishConfig ??= {
180
+ access: "public"
181
+ };
182
+ packageJson.description ??= workspacePackageJson.description;
183
+ packageJson.homepage ??= workspacePackageJson.homepage;
184
+ packageJson.bugs ??= workspacePackageJson.bugs;
185
+ packageJson.license ??= workspacePackageJson.license;
186
+ packageJson.keywords ??= workspacePackageJson.keywords;
187
+ packageJson.funding ??= workspacePackageJson.funding;
188
+ packageJson.author ??= workspacePackageJson.author;
189
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
190
+ if (!packageJson.maintainers && packageJson.author) {
191
+ packageJson.maintainers = [
192
+ packageJson.author
193
+ ];
194
+ }
195
+ packageJson.contributors ??= workspacePackageJson.contributors;
196
+ if (!packageJson.contributors && packageJson.author) {
197
+ packageJson.contributors = [
198
+ packageJson.author
199
+ ];
200
+ }
201
+ packageJson.repository ??= workspacePackageJson.repository;
202
+ packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, "packages", projectName);
203
+ return packageJson;
204
+ }, "addWorkspacePackageJsonFields");
61
205
 
62
206
  // ../config-tools/src/config-file/get-config-file.ts
63
207
  var _c12 = require('c12');
@@ -585,192 +729,11 @@ var getConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (workspace
585
729
  return loadStormConfig(workspaceRoot, skipLogs);
586
730
  }, "getConfig");
587
731
 
588
- // ../build-tools/src/utilities/read-nx-config.ts
589
-
590
-
591
- var readNxConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot) => {
592
- let rootDir = workspaceRoot;
593
- if (!rootDir) {
594
- const config = await getConfig();
595
- rootDir = config.workspaceRoot;
596
- }
597
- const nxJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, rootDir, "nx.json");
598
- if (!_fs.existsSync.call(void 0, nxJsonPath)) {
599
- throw new Error("Cannot find project.json configuration");
600
- }
601
- const configContent = await _promises.readFile.call(void 0, nxJsonPath, "utf8");
602
- return JSON.parse(configContent);
603
- }, "readNxConfig");
604
-
605
- // ../build-tools/src/utilities/copy-assets.ts
606
- var copyAssets = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
607
- const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
608
- pendingAssets.push({
609
- input: _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, projectRoot),
610
- glob: "*.md",
611
- output: "."
612
- });
613
- pendingAssets.push({
614
- input: config.workspaceRoot,
615
- glob: "LICENSE",
616
- output: "."
617
- });
618
- if (generatePackageJson2 === false) {
619
- pendingAssets.push({
620
- input: projectRoot,
621
- glob: "package.json",
622
- output: "."
623
- });
624
- }
625
- if (includeSrc === true) {
626
- pendingAssets.push({
627
- input: sourceRoot,
628
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
629
- output: "src/"
630
- });
631
- }
632
- const nxJson = readNxConfig(config.workspaceRoot);
633
- const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
634
- const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
635
- if (!_optionalChain([projectsConfigurations, 'optionalAccess', _32 => _32.projects, 'optionalAccess', _33 => _33[projectName]])) {
636
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
637
- }
638
- const buildTarget = _optionalChain([projectsConfigurations, 'access', _34 => _34.projects, 'access', _35 => _35[projectName], 'access', _36 => _36.targets, 'optionalAccess', _37 => _37.build]);
639
- if (!buildTarget) {
640
- throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, projectRoot, "project.json")}`);
641
- }
642
- _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
643
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
644
- const result = await _js.copyAssets.call(void 0, {
645
- assets: pendingAssets,
646
- watch: false,
647
- outputPath
648
- }, {
649
- root: config.workspaceRoot,
650
- targetName: "build",
651
- target: buildTarget,
652
- projectName,
653
- projectGraph,
654
- projectsConfigurations,
655
- nxJsonConfiguration: nxJson,
656
- cwd: config.workspaceRoot,
657
- isVerbose: _chunkLXCK6Y4Ccjs.isVerbose.call(void 0, config.logLevel)
658
- });
659
- if (!result.success) {
660
- throw new Error("The Build process failed trying to copy assets");
661
- }
662
- if (includeSrc === true) {
663
- _chunkLXCK6Y4Ccjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, "src")}`, config);
664
- const files = await _glob.glob.call(void 0, [
665
- _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
666
- _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
667
- _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
668
- _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
669
- ]);
670
- await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
671
-
672
- ${await _promises.readFile.call(void 0, file, "utf8")}
673
-
674
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
675
- }
676
- }, "copyAssets");
677
-
678
- // ../build-tools/src/utilities/generate-package-json.ts
679
-
680
-
732
+ // ../build-tools/src/utilities/get-entry-points.ts
681
733
 
682
734
 
683
- var _projectgraph = require('nx/src/project-graph/project-graph');
684
- var addPackageDependencies = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
685
- const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
686
- const localPackages = [];
687
- for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
688
- const projectNode = project.node;
689
- if (projectNode.data.root) {
690
- const projectPackageJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
691
- if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
692
- const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
693
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
694
- if (projectPackageJson.private !== false) {
695
- localPackages.push(projectPackageJson);
696
- }
697
- }
698
- }
699
- }
700
- if (localPackages.length > 0) {
701
- _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
702
- packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
703
- if (!ret[localPackage.name]) {
704
- ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
705
- }
706
- return ret;
707
- }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
708
- packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
709
- if (!ret[localPackage.name]) {
710
- ret[localPackage.name] = {
711
- optional: false
712
- };
713
- }
714
- return ret;
715
- }, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
716
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
717
- if (!ret[localPackage.name]) {
718
- ret[localPackage.name] = localPackage.version || "0.0.1";
719
- }
720
- return ret;
721
- }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
722
- } else {
723
- _chunkLXCK6Y4Ccjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
724
- }
725
- return packageJson;
726
- }, "addPackageDependencies");
727
- var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
728
- const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, );
729
- const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
730
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
731
- packageJson.type ??= "module";
732
- packageJson.sideEffects ??= false;
733
- if (includeSrc === true) {
734
- let distSrc = sourceRoot.replace(projectRoot, "");
735
- if (distSrc.startsWith("/")) {
736
- distSrc = distSrc.substring(1);
737
- }
738
- packageJson.source ??= `${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
739
- }
740
- packageJson.files ??= [
741
- "dist/**/*"
742
- ];
743
- if (includeSrc === true && !packageJson.files.includes("src")) {
744
- packageJson.files.push("src/**/*");
745
- }
746
- packageJson.publishConfig ??= {
747
- access: "public"
748
- };
749
- packageJson.description ??= workspacePackageJson.description;
750
- packageJson.homepage ??= workspacePackageJson.homepage;
751
- packageJson.bugs ??= workspacePackageJson.bugs;
752
- packageJson.license ??= workspacePackageJson.license;
753
- packageJson.keywords ??= workspacePackageJson.keywords;
754
- packageJson.funding ??= workspacePackageJson.funding;
755
- packageJson.author ??= workspacePackageJson.author;
756
- packageJson.maintainers ??= workspacePackageJson.maintainers;
757
- if (!packageJson.maintainers && packageJson.author) {
758
- packageJson.maintainers = [
759
- packageJson.author
760
- ];
761
- }
762
- packageJson.contributors ??= workspacePackageJson.contributors;
763
- if (!packageJson.contributors && packageJson.author) {
764
- packageJson.contributors = [
765
- packageJson.author
766
- ];
767
- }
768
- packageJson.repository ??= workspacePackageJson.repository;
769
- packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, "packages", projectName);
770
- return packageJson;
771
- }, "addWorkspacePackageJsonFields");
735
+ // ../build-tools/src/utilities/read-nx-config.ts
772
736
 
773
- // ../build-tools/src/utilities/get-entry-points.ts
774
737
 
775
738
 
776
739
  // ../build-tools/src/utilities/task-graph.ts
@@ -900,7 +863,7 @@ function inferEntries(pkg, sourceFiles, rootDir) {
900
863
  const SOURCE_RE = new RegExp(
901
864
  `(?<=/|$)${d}${isDir ? "" : String.raw`\.\w+`}$`
902
865
  );
903
- return _optionalChain([sourceFiles, 'access', _38 => _38.find, 'call', _39 => _39((i) => SOURCE_RE.test(i)), 'optionalAccess', _40 => _40.replace, 'call', _41 => _41(/(\.d\.(m|c)?ts|\.\w+)$/, "")]);
866
+ return _optionalChain([sourceFiles, 'access', _32 => _32.find, 'call', _33 => _33((i) => SOURCE_RE.test(i)), 'optionalAccess', _34 => _34.replace, 'call', _35 => _35(/(\.d\.(m|c)?ts|\.\w+)$/, "")]);
904
867
  }, void 0);
905
868
  if (!input) {
906
869
  if (!_fs.existsSync.call(void 0, _pathe.resolve.call(void 0, rootDir || ".", output.file))) {
@@ -1160,7 +1123,7 @@ function shebangPlugin() {
1160
1123
  if (output.type !== "chunk") {
1161
1124
  continue;
1162
1125
  }
1163
- if (_optionalChain([output, 'access', _42 => _42.code, 'optionalAccess', _43 => _43.match, 'call', _44 => _44(SHEBANG_RE)])) {
1126
+ if (_optionalChain([output, 'access', _36 => _36.code, 'optionalAccess', _37 => _37.match, 'call', _38 => _38(SHEBANG_RE)])) {
1164
1127
  const outFile = _pathe.resolve.call(void 0, options.dir, fileName);
1165
1128
  await makeExecutable(outFile);
1166
1129
  }
@@ -1334,7 +1297,7 @@ function fixCJSExportTypePlugin() {
1334
1297
  return {
1335
1298
  name: "unbuild-fix-cjs-export-type",
1336
1299
  renderChunk(code, info, opts) {
1337
- if (info.type !== "chunk" || !info.fileName.endsWith(".d.cts") || !info.isEntry || _optionalChain([info, 'access', _45 => _45.exports, 'optionalAccess', _46 => _46.length]) !== 1 || info.exports[0] !== "default") {
1300
+ if (info.type !== "chunk" || !info.fileName.endsWith(".d.cts") || !info.isEntry || _optionalChain([info, 'access', _39 => _39.exports, 'optionalAccess', _40 => _40.length]) !== 1 || info.exports[0] !== "default") {
1338
1301
  return;
1339
1302
  }
1340
1303
  return code.replace(
@@ -1451,7 +1414,7 @@ function getRollupOptions(ctx) {
1451
1414
  ].filter(Boolean),
1452
1415
  external(originalId) {
1453
1416
  const resolvedId = _utils3.resolveAlias.call(void 0, originalId, _aliases);
1454
- const pkgName = _optionalChain([_mlly.parseNodeModulePath.call(void 0, resolvedId), 'optionalAccess', _47 => _47.name]) || _optionalChain([_mlly.parseNodeModulePath.call(void 0, originalId), 'optionalAccess', _48 => _48.name]) || getpkg(originalId);
1417
+ const pkgName = _optionalChain([_mlly.parseNodeModulePath.call(void 0, resolvedId), 'optionalAccess', _41 => _41.name]) || _optionalChain([_mlly.parseNodeModulePath.call(void 0, originalId), 'optionalAccess', _42 => _42.name]) || getpkg(originalId);
1455
1418
  if (arrayIncludes(ctx.options.externals, pkgName) || arrayIncludes(ctx.options.externals, originalId) || arrayIncludes(ctx.options.externals, resolvedId)) {
1456
1419
  return true;
1457
1420
  }
@@ -1512,7 +1475,7 @@ function getRollupOptions(ctx) {
1512
1475
  }
1513
1476
  _chunkYDYGZTJKcjs.__name.call(void 0, getRollupOptions, "getRollupOptions");
1514
1477
  async function rollupStub(ctx) {
1515
- const babelPlugins = _optionalChain([ctx, 'access', _49 => _49.options, 'access', _50 => _50.stubOptions, 'access', _51 => _51.jiti, 'access', _52 => _52.transformOptions, 'optionalAccess', _53 => _53.babel, 'optionalAccess', _54 => _54.plugins]);
1478
+ const babelPlugins = _optionalChain([ctx, 'access', _43 => _43.options, 'access', _44 => _44.stubOptions, 'access', _45 => _45.jiti, 'access', _46 => _46.transformOptions, 'optionalAccess', _47 => _47.babel, 'optionalAccess', _48 => _48.plugins]);
1516
1479
  const importedBabelPlugins = [];
1517
1480
  const serializedJitiOptions = JSON.stringify(
1518
1481
  {
@@ -1524,7 +1487,7 @@ async function rollupStub(ctx) {
1524
1487
  transformOptions: {
1525
1488
  ...ctx.options.stubOptions.jiti.transformOptions,
1526
1489
  babel: {
1527
- ..._optionalChain([ctx, 'access', _55 => _55.options, 'access', _56 => _56.stubOptions, 'access', _57 => _57.jiti, 'access', _58 => _58.transformOptions, 'optionalAccess', _59 => _59.babel]),
1490
+ ..._optionalChain([ctx, 'access', _49 => _49.options, 'access', _50 => _50.stubOptions, 'access', _51 => _51.jiti, 'access', _52 => _52.transformOptions, 'optionalAccess', _53 => _53.babel]),
1528
1491
  plugins: "__$BABEL_PLUGINS"
1529
1492
  }
1530
1493
  }
@@ -1919,7 +1882,7 @@ _chunkYDYGZTJKcjs.__name.call(void 0, copyBuild, "copyBuild");
1919
1882
  async function build(rootDir, stub, inputConfig = {}) {
1920
1883
  rootDir = _pathe.resolve.call(void 0, process.cwd(), rootDir || ".");
1921
1884
  const jiti = _jiti.createJiti.call(void 0, rootDir);
1922
- const _buildConfig = await jiti.import(_optionalChain([inputConfig, 'optionalAccess', _60 => _60.config]) || "./build.config", {
1885
+ const _buildConfig = await jiti.import(_optionalChain([inputConfig, 'optionalAccess', _54 => _54.config]) || "./build.config", {
1923
1886
  try: !inputConfig.config,
1924
1887
  default: true
1925
1888
  }) || {};
@@ -1946,7 +1909,7 @@ async function build(rootDir, stub, inputConfig = {}) {
1946
1909
  _chunkYDYGZTJKcjs.__name.call(void 0, build, "build");
1947
1910
  async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs, _stubMode, _watchMode) {
1948
1911
  const preset = await resolvePreset(
1949
- buildConfig.preset || _optionalChain([pkg, 'access', _61 => _61.unbuild, 'optionalAccess', _62 => _62.preset]) || _optionalChain([pkg, 'access', _63 => _63.build, 'optionalAccess', _64 => _64.preset]) || inputConfig.preset || "auto",
1912
+ buildConfig.preset || _optionalChain([pkg, 'access', _55 => _55.unbuild, 'optionalAccess', _56 => _56.preset]) || _optionalChain([pkg, 'access', _57 => _57.build, 'optionalAccess', _58 => _58.preset]) || inputConfig.preset || "auto",
1950
1913
  rootDir
1951
1914
  );
1952
1915
  const options = _defu.defu.call(void 0,
@@ -1955,7 +1918,7 @@ async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs,
1955
1918
  inputConfig,
1956
1919
  preset,
1957
1920
  {
1958
- name: (_optionalChain([pkg, 'optionalAccess', _65 => _65.name]) || "").split("/").pop() || "default",
1921
+ name: (_optionalChain([pkg, 'optionalAccess', _59 => _59.name]) || "").split("/").pop() || "default",
1959
1922
  rootDir,
1960
1923
  entries: [],
1961
1924
  clean: true,
@@ -2136,24 +2099,24 @@ async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs,
2136
2099
  for (const entry of ctx.buildEntries.filter((e) => !e.chunk)) {
2137
2100
  let totalBytes = entry.bytes || 0;
2138
2101
  for (const chunk of entry.chunks || []) {
2139
- totalBytes += _optionalChain([ctx, 'access', _66 => _66.buildEntries, 'access', _67 => _67.find, 'call', _68 => _68((e) => e.path === chunk), 'optionalAccess', _69 => _69.bytes]) || 0;
2102
+ totalBytes += _optionalChain([ctx, 'access', _60 => _60.buildEntries, 'access', _61 => _61.find, 'call', _62 => _62((e) => e.path === chunk), 'optionalAccess', _63 => _63.bytes]) || 0;
2140
2103
  }
2141
2104
  let line = ` ${_utils.colors.bold(rPath(entry.path))} (` + [
2142
2105
  totalBytes && `total size: ${_utils.colors.cyan(_prettybytes2.default.call(void 0, totalBytes))}`,
2143
2106
  entry.bytes && `chunk size: ${_utils.colors.cyan(_prettybytes2.default.call(void 0, entry.bytes))}`,
2144
- _optionalChain([entry, 'access', _70 => _70.exports, 'optionalAccess', _71 => _71.length]) && `exports: ${_utils.colors.gray(entry.exports.join(", "))}`
2107
+ _optionalChain([entry, 'access', _64 => _64.exports, 'optionalAccess', _65 => _65.length]) && `exports: ${_utils.colors.gray(entry.exports.join(", "))}`
2145
2108
  ].filter(Boolean).join(", ") + ")";
2146
- if (_optionalChain([entry, 'access', _72 => _72.chunks, 'optionalAccess', _73 => _73.length])) {
2109
+ if (_optionalChain([entry, 'access', _66 => _66.chunks, 'optionalAccess', _67 => _67.length])) {
2147
2110
  line += "\n" + entry.chunks.map((p) => {
2148
2111
  const chunk = ctx.buildEntries.find((e) => e.path === p) || {};
2149
2112
  return _utils.colors.gray(
2150
2113
  " \u2514\u2500 " + rPath(p) + _utils.colors.bold(
2151
- chunk.bytes ? ` (${_prettybytes2.default.call(void 0, _optionalChain([chunk, 'optionalAccess', _74 => _74.bytes]))})` : ""
2114
+ chunk.bytes ? ` (${_prettybytes2.default.call(void 0, _optionalChain([chunk, 'optionalAccess', _68 => _68.bytes]))})` : ""
2152
2115
  )
2153
2116
  );
2154
2117
  }).join("\n");
2155
2118
  }
2156
- if (_optionalChain([entry, 'access', _75 => _75.modules, 'optionalAccess', _76 => _76.length])) {
2119
+ if (_optionalChain([entry, 'access', _69 => _69.modules, 'optionalAccess', _70 => _70.length])) {
2157
2120
  line += "\n" + entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.bytes || 0) - (a.bytes || 0)).map((m) => {
2158
2121
  return _utils.colors.gray(
2159
2122
  " \u{1F4E6} " + rPath(m.id) + _utils.colors.bold(m.bytes ? ` (${_prettybytes2.default.call(void 0, m.bytes)})` : "")
@@ -2503,7 +2466,7 @@ _chunkYDYGZTJKcjs.__name.call(void 0, executeUnbuild, "executeUnbuild");
2503
2466
  async function copyBuildAssets(options) {
2504
2467
  _chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
2505
2468
  const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, `${options.name} asset copy`);
2506
- await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
2469
+ await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
2507
2470
  stopwatch();
2508
2471
  return options;
2509
2472
  }
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunk2FZRLS3Zcjs = require('./chunk-2FZRLS3Z.cjs');
8
+ var _chunkN2XPKSKOcjs = require('./chunk-N2XPKSKO.cjs');
9
9
 
10
10
 
11
11
 
@@ -35,4 +35,4 @@ require('./chunk-YDYGZTJK.cjs');
35
35
 
36
36
 
37
37
 
38
- exports.build = _chunk2FZRLS3Zcjs.build; exports.clean = _chunkCUQLNBV5cjs.clean; exports.cleanDirectories = _chunkCUQLNBV5cjs.cleanDirectories; exports.cleanOutputPath = _chunk2FZRLS3Zcjs.cleanOutputPath; exports.copyBuildAssets = _chunk2FZRLS3Zcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunk26OHEX55cjs.createTsCompilerOptions; exports.executeUnbuild = _chunk2FZRLS3Zcjs.executeUnbuild; exports.generatePackageJson = _chunk2FZRLS3Zcjs.generatePackageJson; exports.getDefaultBuildPlugins = _chunkO45RUFL3cjs.getDefaultBuildPlugins; exports.loadConfig = _chunk26OHEX55cjs.loadConfig; exports.resolveOptions = _chunk2FZRLS3Zcjs.resolveOptions;
38
+ exports.build = _chunkN2XPKSKOcjs.build; exports.clean = _chunkCUQLNBV5cjs.clean; exports.cleanDirectories = _chunkCUQLNBV5cjs.cleanDirectories; exports.cleanOutputPath = _chunkN2XPKSKOcjs.cleanOutputPath; exports.copyBuildAssets = _chunkN2XPKSKOcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunk26OHEX55cjs.createTsCompilerOptions; exports.executeUnbuild = _chunkN2XPKSKOcjs.executeUnbuild; exports.generatePackageJson = _chunkN2XPKSKOcjs.generatePackageJson; exports.getDefaultBuildPlugins = _chunkO45RUFL3cjs.getDefaultBuildPlugins; exports.loadConfig = _chunk26OHEX55cjs.loadConfig; exports.resolveOptions = _chunkN2XPKSKOcjs.resolveOptions;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-6K2BOPQA.js";
8
+ } from "./chunk-BZJA6TK2.js";
9
9
  import {
10
10
  clean,
11
11
  cleanDirectories
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/unbuild",
3
- "version": "0.30.6",
3
+ "version": "0.31.1",
4
4
  "type": "module",
5
5
  "description": "A package containing `unbuild` utilities for building Storm Software libraries and applications",
6
6
  "repository": {
@@ -171,9 +171,9 @@
171
171
  "@nx/devkit": "^20.3.1",
172
172
  "@nx/js": "^20.3.1",
173
173
  "@rollup/pluginutils": "^5.1.4",
174
- "@storm-software/build-tools": "workspace:*",
175
- "@storm-software/config": "workspace:*",
176
- "@storm-software/config-tools": "workspace:*",
174
+ "@storm-software/build-tools": "0.136.1",
175
+ "@storm-software/config": "1.99.1",
176
+ "@storm-software/config-tools": "1.142.1",
177
177
  "@swc/core": "1.7.26",
178
178
  "@types/node": "^22.10.2",
179
179
  "commander": "^12.1.0",