@storm-software/projen 0.21.269 → 0.21.273

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.
@@ -3,11 +3,11 @@ import {
3
3
  isAbsolute,
4
4
  joinPaths,
5
5
  relative
6
- } from "./chunk-N2K4KUKN.mjs";
6
+ } from "./chunk-LDQSXIL7.mjs";
7
7
  import {
8
8
  __dirname,
9
9
  init_esm_shims
10
- } from "./chunk-EX3A5QWC.mjs";
10
+ } from "./chunk-PEAVGRTD.mjs";
11
11
 
12
12
  // src/generators/init/generator.ts
13
13
  init_esm_shims();
@@ -2491,1104 +2491,703 @@ var LARGE_BUFFER = 1024 * 1e6;
2491
2491
 
2492
2492
  // ../workspace-tools/src/executors/esbuild/executor.ts
2493
2493
  init_esm_shims();
2494
+ import { createJiti } from "jiti";
2495
+ async function esbuildExecutorFn(options, context, config) {
2496
+ writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
2497
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
2498
+ throw new Error(
2499
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
2500
+ );
2501
+ }
2502
+ const jiti = createJiti(config?.workspaceRoot || process.cwd(), {
2503
+ fsCache: config?.skipCache ? false : joinPaths(
2504
+ config?.workspaceRoot || process.cwd(),
2505
+ config?.directories?.cache || "node_modules/.cache/storm",
2506
+ "jiti"
2507
+ ),
2508
+ interopDefault: true
2509
+ });
2510
+ const { build: build2 } = await jiti.import(jiti.esmResolve("@storm-software/esbuild"));
2511
+ await build2({
2512
+ ...options,
2513
+ projectRoot: (
2514
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2515
+ context.projectsConfigurations.projects?.[context.projectName].root
2516
+ ),
2517
+ name: context.projectName,
2518
+ sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
2519
+ format: options.format,
2520
+ platform: options.platform
2521
+ });
2522
+ return {
2523
+ success: true
2524
+ };
2525
+ }
2526
+ var executor_default6 = withRunExecutor(
2527
+ "Storm ESBuild build",
2528
+ esbuildExecutorFn,
2529
+ {
2530
+ skipReadingConfig: false,
2531
+ hooks: {
2532
+ applyDefaultOptions: async (options) => {
2533
+ options.entry ??= ["src/index.ts"];
2534
+ options.outputPath ??= "dist/{projectRoot}";
2535
+ options.tsconfig ??= "{projectRoot}/tsconfig.json";
2536
+ return options;
2537
+ }
2538
+ }
2539
+ }
2540
+ );
2494
2541
 
2495
- // ../esbuild/src/build.ts
2496
- init_esm_shims();
2497
-
2498
- // ../esbuild/src/assets.ts
2542
+ // ../workspace-tools/src/executors/napi/executor.ts
2499
2543
  init_esm_shims();
2544
+ import { createJiti as createJiti2 } from "jiti";
2545
+ import { fileExists } from "nx/src/utils/fileutils";
2546
+ async function napiExecutor(options, context, config) {
2547
+ const jiti = createJiti2(config.workspaceRoot, {
2548
+ fsCache: config.skipCache ? false : joinPaths(
2549
+ config.workspaceRoot,
2550
+ config.directories.cache || "node_modules/.cache/storm",
2551
+ "jiti"
2552
+ ),
2553
+ interopDefault: true
2554
+ });
2555
+ const { NapiCli } = await jiti.import(
2556
+ jiti.esmResolve("@napi-rs/cli")
2557
+ );
2558
+ if (!context.projectGraph?.nodes[context.projectName ?? ""]) {
2559
+ throw new Error(
2560
+ "The Napi Build process failed because the project could not be found in the project graph. Please run this command from a workspace root directory."
2561
+ );
2562
+ }
2563
+ const projectRoot = context.projectGraph?.nodes[context.projectName ?? ""]?.data.root;
2564
+ const packageJson = joinPaths(projectRoot ?? ".", "package.json");
2565
+ if (!fileExists(packageJson)) {
2566
+ throw new Error(`Could not find package.json at ${packageJson}`);
2567
+ }
2568
+ const napi = new NapiCli();
2569
+ const normalizedOptions = { ...options };
2570
+ const metadata = cargoMetadata();
2571
+ normalizedOptions.targetDir = options.targetDir || metadata?.target_directory || joinPaths(config.workspaceRoot, "dist", "target");
2572
+ normalizedOptions.outputDir = options.outputPath;
2573
+ normalizedOptions.packageJsonPath ??= packageJson;
2574
+ if (options.cwd) {
2575
+ normalizedOptions.cwd = correctPaths(options.cwd);
2576
+ } else {
2577
+ const absoluteProjectRoot = correctPaths(
2578
+ joinPaths(config.workspaceRoot, projectRoot || ".")
2579
+ );
2580
+ normalizedOptions.cwd = absoluteProjectRoot;
2581
+ if (normalizedOptions.outputDir) {
2582
+ normalizedOptions.outputDir = relative(
2583
+ normalizedOptions.cwd,
2584
+ correctPaths(
2585
+ isAbsolute(normalizedOptions.outputDir) ? normalizedOptions.outputDir : joinPaths(config.workspaceRoot, normalizedOptions.outputDir)
2586
+ )
2587
+ );
2588
+ }
2589
+ if (normalizedOptions.packageJsonPath) {
2590
+ normalizedOptions.packageJsonPath = relative(
2591
+ normalizedOptions.cwd,
2592
+ correctPaths(
2593
+ isAbsolute(normalizedOptions.packageJsonPath) ? normalizedOptions.packageJsonPath : joinPaths(config.workspaceRoot, normalizedOptions.packageJsonPath)
2594
+ )
2595
+ );
2596
+ }
2597
+ if (normalizedOptions.configPath) {
2598
+ normalizedOptions.configPath = relative(
2599
+ normalizedOptions.cwd,
2600
+ correctPaths(
2601
+ isAbsolute(normalizedOptions.configPath) ? normalizedOptions.configPath : joinPaths(config.workspaceRoot, normalizedOptions.configPath)
2602
+ )
2603
+ );
2604
+ }
2605
+ if (normalizedOptions.manifestPath) {
2606
+ normalizedOptions.manifestPath = relative(
2607
+ normalizedOptions.cwd,
2608
+ correctPaths(
2609
+ isAbsolute(normalizedOptions.manifestPath) ? normalizedOptions.manifestPath : joinPaths(config.workspaceRoot, normalizedOptions.manifestPath)
2610
+ )
2611
+ );
2612
+ }
2613
+ }
2614
+ if (process.env.VERCEL) {
2615
+ return { success: true };
2616
+ }
2617
+ writeDebug(
2618
+ `Normalized Napi Options:
2619
+ packageJsonPath: ${normalizedOptions.packageJsonPath}
2620
+ outputDir: ${normalizedOptions.outputDir}
2621
+ targetDir: ${normalizedOptions.targetDir}
2622
+ manifestPath: ${normalizedOptions.manifestPath}
2623
+ configPath: ${normalizedOptions.configPath}
2624
+ cwd: ${normalizedOptions.cwd}`,
2625
+ config
2626
+ );
2627
+ const { task } = await napi.build(normalizedOptions);
2628
+ return { success: true, terminalOutput: await task };
2629
+ }
2630
+ var executor_default7 = withRunExecutor(
2631
+ "Napi - Build Bindings",
2632
+ napiExecutor,
2633
+ {
2634
+ skipReadingConfig: false,
2635
+ hooks: {
2636
+ applyDefaultOptions: (options) => {
2637
+ options.outputPath ??= "{sourceRoot}";
2638
+ options.toolchain ??= "stable";
2639
+ options.dtsCache ??= true;
2640
+ options.platform ??= true;
2641
+ options.constEnum ??= false;
2642
+ options.verbose ??= false;
2643
+ options.jsBinding ??= "binding.js";
2644
+ options.dts ??= "binding.d.ts";
2645
+ return options;
2646
+ }
2647
+ }
2648
+ }
2649
+ );
2500
2650
 
2501
- // ../build-tools/src/index.ts
2651
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
2502
2652
  init_esm_shims();
2503
2653
 
2504
- // ../build-tools/src/config.ts
2654
+ // ../pnpm-tools/src/index.ts
2505
2655
  init_esm_shims();
2506
- var DEFAULT_JS_BANNER = `
2507
- // ---------------------------------------
2508
- // \u{1F5F2} Built by Storm Software
2509
- // ---------------------------------------
2510
- `;
2511
- var DEFAULT_CSS_BANNER = `
2512
- /* ---------------------------------------
2513
- \u{1F5F2} Built by Storm Software
2514
- --------------------------------------- */
2515
- `;
2516
- var DEFAULT_ENVIRONMENT = "production";
2517
- var DEFAULT_TARGET = "esnext";
2518
- var DEFAULT_ORGANIZATION = "storm-software";
2519
2656
 
2520
- // ../build-tools/src/plugins/index.ts
2657
+ // ../pnpm-tools/src/helpers/index.ts
2521
2658
  init_esm_shims();
2522
2659
 
2523
- // ../build-tools/src/plugins/analyze.ts
2660
+ // ../pnpm-tools/src/helpers/catalog.ts
2524
2661
  init_esm_shims();
2525
2662
 
2526
- // ../build-tools/src/plugins/swc.ts
2663
+ // ../npm-tools/src/constants.ts
2527
2664
  init_esm_shims();
2528
- import { transform } from "@swc/core";
2529
2665
 
2530
- // ../build-tools/src/plugins/ts-resolve.ts
2666
+ // ../npm-tools/src/helpers/get-version.ts
2531
2667
  init_esm_shims();
2532
- import fs from "node:fs";
2533
- import { builtinModules } from "node:module";
2534
- import path from "node:path";
2535
- import _resolve from "resolve";
2668
+ import { exec as exec2 } from "node:child_process";
2669
+ import { valid } from "semver";
2670
+ import stripAnsi from "strip-ansi";
2536
2671
 
2537
- // ../build-tools/src/plugins/type-definitions.ts
2672
+ // ../npm-tools/src/helpers/get-registry.ts
2538
2673
  init_esm_shims();
2539
- import { stripIndents } from "@nx/devkit";
2540
- import { relative as relative3 } from "path";
2674
+ import { exec } from "node:child_process";
2541
2675
 
2542
- // ../build-tools/src/types.ts
2543
- init_esm_shims();
2676
+ // ../pnpm-tools/src/helpers/catalog.ts
2677
+ import { coerce, gt, valid as valid2 } from "semver";
2544
2678
 
2545
- // ../build-tools/src/utilities/index.ts
2679
+ // ../pnpm-tools/src/helpers/format.ts
2546
2680
  init_esm_shims();
2547
2681
 
2548
- // ../build-tools/src/utilities/copy-assets.ts
2682
+ // ../pnpm-tools/src/helpers/pnpm-workspace.ts
2549
2683
  init_esm_shims();
2550
- import { CopyAssetsHandler } from "@nx/js/internal";
2551
- import { glob } from "glob";
2684
+ import { existsSync as existsSync4 } from "node:fs";
2552
2685
  import { readFile as readFile2, writeFile } from "node:fs/promises";
2553
- var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
2554
- const pendingAssets = Array.from(assets ?? []);
2555
- pendingAssets.push({
2556
- input: projectRoot,
2557
- glob: "*.md",
2558
- output: "."
2559
- });
2560
- pendingAssets.push({
2561
- input: ".",
2562
- glob: "LICENSE",
2563
- output: "."
2564
- });
2565
- if (generatePackageJson3 === false) {
2566
- pendingAssets.push({
2567
- input: projectRoot,
2568
- glob: "package.json",
2569
- output: "."
2570
- });
2571
- }
2572
- if (includeSrc === true) {
2573
- pendingAssets.push({
2574
- input: sourceRoot,
2575
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
2576
- output: "src/"
2577
- });
2578
- }
2579
- writeTrace(
2580
- `\u{1F4DD} Copying the following assets to the output directory:
2581
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
2582
- config
2583
- );
2584
- const assetHandler = new CopyAssetsHandler({
2585
- projectDir: projectRoot,
2586
- rootDir: config.workspaceRoot,
2587
- outputDir: outputPath,
2588
- assets: pendingAssets
2589
- });
2590
- await assetHandler.processAllAssetsOnce();
2591
- writeTrace("Completed copying assets to the output directory", config);
2592
- if (includeSrc === true) {
2593
- writeDebug(
2594
- `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
2595
- outputPath,
2596
- "src"
2597
- )}`,
2598
- config
2599
- );
2600
- const files = await glob([
2601
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
2602
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
2603
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
2604
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
2605
- ]);
2606
- await Promise.allSettled(
2607
- files.map(
2608
- async (file) => writeFile(
2609
- file,
2610
- `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
2611
-
2612
- ${await readFile2(file, "utf8")}
2613
-
2614
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
2615
- )
2616
- )
2617
- );
2618
- }
2619
- };
2686
+ import { parse, stringify } from "yaml";
2620
2687
 
2621
- // ../build-tools/src/utilities/generate-package-json.ts
2688
+ // ../pnpm-tools/src/helpers/replace-deps-aliases.ts
2622
2689
  init_esm_shims();
2623
- import { calculateProjectBuildableDependencies } from "@nx/js/internal";
2624
- import { Glob } from "glob";
2625
- import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
2626
- import { readFile as readFile3 } from "node:fs/promises";
2627
2690
  import {
2628
2691
  createProjectGraphAsync,
2629
- readCachedProjectGraph,
2630
- readProjectsConfigurationFromProjectGraph
2631
- } from "nx/src/project-graph/project-graph";
2632
- var addPackageDependencies = async (workspaceRoot2, projectRoot, projectName, packageJson) => {
2633
- let projectGraph;
2634
- try {
2635
- projectGraph = readCachedProjectGraph();
2636
- } catch {
2637
- await createProjectGraphAsync();
2638
- projectGraph = readCachedProjectGraph();
2639
- }
2640
- if (!projectGraph) {
2641
- throw new Error(
2642
- "The Build process failed because the project graph is not available. Please run the build command again."
2643
- );
2644
- }
2645
- const projectDependencies = calculateProjectBuildableDependencies(
2646
- void 0,
2647
- projectGraph,
2648
- workspaceRoot2,
2649
- projectName,
2650
- process.env.NX_TASK_TARGET_TARGET || "build",
2651
- process.env.NX_TASK_TARGET_CONFIGURATION || "production",
2652
- true
2653
- );
2654
- const localPackages = [];
2655
- for (const project of projectDependencies.dependencies.filter(
2656
- (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot2
2657
- )) {
2658
- const projectNode = project.node;
2659
- if (projectNode.data.root) {
2660
- const projectPackageJsonPath = joinPaths(
2661
- workspaceRoot2,
2662
- projectNode.data.root,
2663
- "package.json"
2664
- );
2665
- if (existsSync4(projectPackageJsonPath)) {
2666
- const projectPackageJsonContent = await readFile3(
2667
- projectPackageJsonPath,
2668
- "utf8"
2669
- );
2670
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
2671
- if (projectPackageJson.private !== true) {
2672
- localPackages.push(projectPackageJson);
2673
- }
2674
- }
2675
- }
2676
- }
2677
- if (localPackages.length > 0) {
2678
- writeTrace(
2679
- `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
2680
- );
2681
- const projectJsonFile = await readFile3(
2682
- joinPaths(projectRoot, "project.json"),
2683
- "utf8"
2684
- );
2685
- const projectJson = JSON.parse(projectJsonFile);
2686
- const projectName2 = projectJson.name;
2687
- const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
2688
- if (!projectConfigurations?.projects?.[projectName2]) {
2689
- throw new Error(
2690
- "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."
2691
- );
2692
- }
2693
- const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
2694
- if (projectConfigurations.projects?.[dep]) {
2695
- const depPackageJsonPath = joinPaths(
2696
- workspaceRoot2,
2697
- projectConfigurations.projects[dep].root,
2698
- "package.json"
2699
- );
2700
- if (existsSync4(depPackageJsonPath)) {
2701
- const depPackageJsonContent = readFileSync3(
2702
- depPackageJsonPath,
2703
- "utf8"
2704
- );
2705
- const depPackageJson = JSON.parse(depPackageJsonContent);
2706
- if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
2707
- ret.push(depPackageJson.name);
2708
- }
2709
- }
2710
- }
2711
- return ret;
2712
- }, []);
2713
- packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
2714
- if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
2715
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
2716
- }
2717
- return ret;
2718
- }, packageJson.dependencies ?? {});
2719
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
2720
- if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
2721
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
2722
- }
2723
- return ret;
2724
- }, packageJson.devDependencies ?? {});
2725
- } else {
2726
- writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
2692
+ readCachedProjectGraph
2693
+ } from "@nx/devkit";
2694
+ import { existsSync as existsSync5 } from "node:fs";
2695
+ import { readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
2696
+ import { format } from "prettier";
2697
+
2698
+ // ../pnpm-tools/src/types.ts
2699
+ init_esm_shims();
2700
+
2701
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
2702
+ import { createJiti as createJiti4 } from "jiti";
2703
+ import { execSync as execSync3 } from "node:child_process";
2704
+ import { readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
2705
+ import { format as format3 } from "prettier";
2706
+
2707
+ // ../workspace-tools/src/utils/github.ts
2708
+ init_esm_shims();
2709
+ import { createJiti as createJiti3 } from "jiti";
2710
+
2711
+ // ../workspace-tools/src/utils/package-helpers.ts
2712
+ init_esm_shims();
2713
+ import {
2714
+ joinPathFragments as joinPathFragments3,
2715
+ readJsonFile
2716
+ } from "@nx/devkit";
2717
+ import { execFileSync } from "child_process";
2718
+ import { existsSync as existsSync6 } from "node:fs";
2719
+ import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
2720
+ import { dirname, resolve } from "path";
2721
+ import { format as format2 } from "prettier";
2722
+
2723
+ // ../workspace-tools/src/utils/project-tags.ts
2724
+ init_esm_shims();
2725
+
2726
+ // ../package-constants/src/tags.ts
2727
+ init_esm_shims();
2728
+ var ProjectTagConstants = {
2729
+ Language: {
2730
+ TAG_ID: "language",
2731
+ TYPESCRIPT: "typescript",
2732
+ RUST: "rust"
2733
+ },
2734
+ ProjectType: {
2735
+ TAG_ID: "type",
2736
+ LIBRARY: "library",
2737
+ APPLICATION: "application"
2738
+ },
2739
+ ProjectLinking: {
2740
+ TAG_ID: "project-linking",
2741
+ REFERENCE: "reference",
2742
+ ALIAS: "alias"
2743
+ },
2744
+ DistStyle: {
2745
+ TAG_ID: "dist-style",
2746
+ NORMAL: "normal",
2747
+ CLEAN: "clean"
2748
+ },
2749
+ Provider: {
2750
+ TAG_ID: "provider"
2751
+ },
2752
+ Platform: {
2753
+ TAG_ID: "platform",
2754
+ NODE: "node",
2755
+ BROWSER: "browser",
2756
+ NEUTRAL: "neutral",
2757
+ WORKER: "worker"
2758
+ },
2759
+ Registry: {
2760
+ TAG_ID: "registry",
2761
+ CARGO: "cargo",
2762
+ NPM: "npm",
2763
+ CONTAINER: "container",
2764
+ CYCLONE: "cyclone"
2765
+ },
2766
+ Plugin: {
2767
+ TAG_ID: "plugin"
2768
+ },
2769
+ Builder: {
2770
+ TAG_ID: "builder",
2771
+ TSC: "tsc",
2772
+ TSUP: "tsup",
2773
+ TSDOWN: "tsdown",
2774
+ VITE: "vite",
2775
+ ROLLDOWN: "rolldown"
2727
2776
  }
2728
- return packageJson;
2729
2777
  };
2730
- var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
2731
- const workspaceRoot2 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
2732
- const workspacePackageJsonContent = await readFile3(
2733
- joinPaths(workspaceRoot2, "package.json"),
2734
- "utf8"
2778
+ var formatProjectTag = (variant, value) => {
2779
+ return `${variant}:${value}`;
2780
+ };
2781
+ var hasProjectTag = (project, variant) => {
2782
+ project.tags = project.tags ?? [];
2783
+ const prefix = formatProjectTag(variant, "");
2784
+ return project.tags.some(
2785
+ (tag) => tag.startsWith(prefix) && tag.length > prefix.length
2735
2786
  );
2736
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
2737
- packageJson.type ??= "module";
2738
- packageJson.sideEffects ??= false;
2739
- if (includeSrc === true) {
2740
- let distSrc = sourceRoot.replace(projectRoot, "");
2741
- if (distSrc.startsWith("/")) {
2742
- distSrc = distSrc.substring(1);
2743
- }
2744
- packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
2745
- }
2746
- packageJson.files ??= ["dist/**/*"];
2747
- if (includeSrc === true && !packageJson.files.includes("src")) {
2748
- packageJson.files.push("src/**/*");
2749
- }
2750
- packageJson.publishConfig ??= {
2751
- access: "public"
2752
- };
2753
- packageJson.description ??= workspacePackageJson.description;
2754
- packageJson.homepage ??= workspacePackageJson.homepage;
2755
- packageJson.bugs ??= workspacePackageJson.bugs;
2756
- packageJson.license ??= workspacePackageJson.license;
2757
- packageJson.keywords ??= workspacePackageJson.keywords;
2758
- packageJson.funding ??= workspacePackageJson.funding;
2759
- packageJson.author ??= workspacePackageJson.author;
2760
- packageJson.maintainers ??= workspacePackageJson.maintainers;
2761
- if (!packageJson.maintainers && packageJson.author) {
2762
- packageJson.maintainers = [packageJson.author];
2763
- }
2764
- packageJson.contributors ??= workspacePackageJson.contributors;
2765
- if (!packageJson.contributors && packageJson.author) {
2766
- packageJson.contributors = [packageJson.author];
2767
- }
2768
- packageJson.repository ??= workspacePackageJson.repository;
2769
- packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
2770
- return packageJson;
2771
2787
  };
2772
- var addPackageJsonExport = (file, type = "module", sourceRoot) => {
2773
- let entry = file.replaceAll("\\", "/");
2774
- if (sourceRoot) {
2775
- entry = entry.replace(sourceRoot, "");
2788
+
2789
+ // ../workspace-tools/src/utils/project-tags.ts
2790
+ var addProjectTag = (project, variant, value, options = {
2791
+ overwrite: false
2792
+ }) => {
2793
+ project.tags = project.tags ?? [];
2794
+ if (options.overwrite || !hasProjectTag(project, variant)) {
2795
+ project.tags = project.tags.filter(
2796
+ (tag) => !tag.startsWith(formatProjectTag(variant, ""))
2797
+ );
2798
+ project.tags.push(formatProjectTag(variant, value));
2776
2799
  }
2777
- return {
2778
- import: {
2779
- types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
2780
- default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
2781
- },
2782
- require: {
2783
- types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
2784
- default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
2785
- },
2786
- default: {
2787
- types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
2788
- default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
2789
- }
2790
- };
2791
2800
  };
2792
2801
 
2793
- // ../build-tools/src/utilities/get-entry-points.ts
2794
- init_esm_shims();
2795
- import { glob as glob2 } from "glob";
2802
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
2803
+ var LARGE_BUFFER2 = 1024 * 1e6;
2796
2804
 
2797
- // ../build-tools/src/utilities/get-env.ts
2805
+ // ../workspace-tools/src/executors/size-limit/executor.ts
2798
2806
  init_esm_shims();
2799
- var getEnv = (builder, options) => {
2807
+ import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
2808
+ import esBuildPlugin from "@size-limit/esbuild";
2809
+ import esBuildWhyPlugin from "@size-limit/esbuild-why";
2810
+ import filePlugin from "@size-limit/file";
2811
+ import sizeLimit from "size-limit";
2812
+ async function sizeLimitExecutorFn(options, context, config) {
2813
+ if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
2814
+ throw new Error(
2815
+ "The Size-Limit process failed because the context is not valid. Please run this command from a workspace."
2816
+ );
2817
+ }
2818
+ writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
2819
+ sizeLimit([filePlugin, esBuildPlugin, esBuildWhyPlugin], {
2820
+ checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments4(
2821
+ context.projectsConfigurations.projects[context.projectName]?.root ?? "./",
2822
+ "src"
2823
+ )
2824
+ }).then((result) => {
2825
+ writeInfo(
2826
+ `\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`,
2827
+ config
2828
+ );
2829
+ });
2800
2830
  return {
2801
- STORM_BUILD: builder,
2802
- STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
2803
- STORM_NAME: options.name,
2804
- STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
2805
- STORM_PLATFORM: options.platform,
2806
- STORM_FORMAT: JSON.stringify(options.format),
2807
- STORM_TARGET: JSON.stringify(options.target),
2808
- ...options.env
2831
+ success: true
2809
2832
  };
2810
- };
2833
+ }
2834
+ var executor_default8 = withRunExecutor(
2835
+ "Size-Limit Performance Test Executor",
2836
+ sizeLimitExecutorFn,
2837
+ {
2838
+ skipReadingConfig: false,
2839
+ hooks: {
2840
+ applyDefaultOptions: (options) => {
2841
+ return options;
2842
+ }
2843
+ }
2844
+ }
2845
+ );
2811
2846
 
2812
- // ../build-tools/src/utilities/get-file-banner.ts
2847
+ // ../workspace-tools/src/executors/tsdown/executor.ts
2813
2848
  init_esm_shims();
2814
2849
 
2815
- // ../build-tools/src/utilities/get-out-extension.ts
2850
+ // ../tsdown/src/build.ts
2816
2851
  init_esm_shims();
2852
+ import {
2853
+ createProjectGraphAsync as createProjectGraphAsync3,
2854
+ readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2,
2855
+ writeJsonFile
2856
+ } from "@nx/devkit";
2817
2857
 
2818
- // ../build-tools/src/utilities/get-project-deps.ts
2858
+ // ../build-tools/src/index.ts
2819
2859
  init_esm_shims();
2820
2860
 
2821
- // ../build-tools/src/utilities/read-nx-config.ts
2861
+ // ../build-tools/src/config.ts
2822
2862
  init_esm_shims();
2823
- import { existsSync as existsSync5 } from "node:fs";
2824
- import { readFile as readFile4 } from "node:fs/promises";
2863
+ var DEFAULT_ENVIRONMENT = "production";
2864
+ var DEFAULT_TARGET = "esnext";
2865
+ var DEFAULT_ORGANIZATION = "storm-software";
2825
2866
 
2826
- // ../build-tools/src/utilities/task-graph.ts
2867
+ // ../build-tools/src/plugins/index.ts
2827
2868
  init_esm_shims();
2828
- import {
2829
- createTaskGraph,
2830
- mapTargetDefaultsToDependencies
2831
- } from "nx/src/tasks-runner/create-task-graph";
2832
-
2833
- // ../esbuild/src/assets.ts
2834
- async function copyBuildAssets(context) {
2835
- if (!context.result?.errors.length && context.options.assets?.length) {
2836
- writeDebug(
2837
- ` \u{1F4CB} Copying ${context.options.assets.length} asset files to output directory: ${context.outputPath}`,
2838
- context.workspaceConfig
2839
- );
2840
- const stopwatch = getStopwatch(`${context.options.name} asset copy`);
2841
- await copyAssets(
2842
- context.workspaceConfig,
2843
- context.options.assets ?? [],
2844
- context.outputPath,
2845
- context.options.projectRoot,
2846
- context.sourceRoot,
2847
- true,
2848
- false
2849
- );
2850
- stopwatch();
2851
- }
2852
- return context;
2853
- }
2854
2869
 
2855
- // ../esbuild/src/clean.ts
2870
+ // ../build-tools/src/plugins/analyze.ts
2856
2871
  init_esm_shims();
2857
- import { rm } from "node:fs/promises";
2858
- async function cleanDirectories(directory) {
2859
- await rm(directory, { recursive: true, force: true });
2860
- }
2861
2872
 
2862
- // ../esbuild/src/context.ts
2873
+ // ../build-tools/src/plugins/swc.ts
2863
2874
  init_esm_shims();
2864
- import {
2865
- createProjectGraphAsync as createProjectGraphAsync2,
2866
- readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2
2867
- } from "@nx/devkit";
2868
- import defu4 from "defu";
2869
- import { existsSync as existsSync6 } from "node:fs";
2870
- import hf from "node:fs/promises";
2871
- import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
2875
+ import { transform } from "@swc/core";
2872
2876
 
2873
- // ../esbuild/src/config.ts
2877
+ // ../build-tools/src/plugins/ts-resolve.ts
2874
2878
  init_esm_shims();
2875
- var DEFAULT_BUILD_OPTIONS = {
2876
- platform: "node",
2877
- target: "node22",
2878
- format: "esm",
2879
- mode: "production",
2880
- generatePackageJson: true,
2881
- includeSrc: false,
2882
- keepNames: true,
2883
- metafile: false,
2884
- treeshake: true,
2885
- splitting: true,
2886
- shims: false,
2887
- watch: false,
2888
- bundle: true,
2889
- distDir: "dist",
2890
- loader: {
2891
- ".aac": "file",
2892
- ".css": "file",
2893
- ".eot": "file",
2894
- ".flac": "file",
2895
- ".gif": "file",
2896
- ".jpeg": "file",
2897
- ".jpg": "file",
2898
- ".mp3": "file",
2899
- ".mp4": "file",
2900
- ".ogg": "file",
2901
- ".otf": "file",
2902
- ".png": "file",
2903
- ".svg": "file",
2904
- ".ttf": "file",
2905
- ".wav": "file",
2906
- ".webm": "file",
2907
- ".webp": "file",
2908
- ".woff": "file",
2909
- ".woff2": "file"
2910
- },
2911
- banner: {
2912
- js: DEFAULT_JS_BANNER,
2913
- css: DEFAULT_CSS_BANNER
2914
- }
2915
- };
2916
-
2917
- // ../esbuild/src/context.ts
2918
- async function resolveContext(userOptions) {
2919
- const projectRoot = userOptions.projectRoot;
2920
- const workspaceRoot2 = findWorkspaceRoot2(projectRoot);
2921
- if (!workspaceRoot2) {
2922
- throw new Error("Cannot find Nx workspace root");
2923
- }
2924
- const workspaceConfig = await getWorkspaceConfig(true, {
2925
- workspaceRoot: workspaceRoot2.dir
2926
- });
2927
- writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
2928
- const stopwatch = getStopwatch("Build options resolution");
2929
- const projectGraph = await createProjectGraphAsync2({
2930
- exitOnError: true
2931
- });
2932
- const projectJsonPath = joinPaths(
2933
- workspaceRoot2.dir,
2934
- projectRoot,
2935
- "project.json"
2936
- );
2937
- if (!existsSync6(projectJsonPath)) {
2938
- throw new Error("Cannot find project.json configuration");
2939
- }
2940
- const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
2941
- const projectJson = JSON.parse(projectJsonFile);
2942
- const projectName = projectJson.name || userOptions.name;
2943
- const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
2944
- if (!projectConfigurations?.projects?.[projectName]) {
2945
- throw new Error(
2946
- "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."
2947
- );
2948
- }
2949
- const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
2950
- options.name ??= projectName;
2951
- const packageJsonPath = joinPaths(
2952
- workspaceRoot2.dir,
2953
- options.projectRoot,
2954
- "package.json"
2955
- );
2956
- if (!existsSync6(packageJsonPath)) {
2957
- throw new Error("Cannot find package.json configuration");
2958
- }
2959
- const env = getEnv("esbuild", options);
2960
- const define = defu4(options.define ?? {}, env ?? {});
2961
- const resolvedOptions = {
2962
- ...options,
2963
- tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths(workspaceRoot2.dir, projectRoot, "tsconfig.json"),
2964
- metafile: userOptions.mode === "development",
2965
- clean: false,
2966
- env,
2967
- define: {
2968
- STORM_FORMAT: JSON.stringify(options.format),
2969
- ...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
2970
- const value = JSON.stringify(define[key]);
2971
- const safeKey = key.replaceAll("(", "").replaceAll(")", "");
2972
- return {
2973
- ...res,
2974
- [`process.env.${safeKey}`]: value,
2975
- [`import.meta.env.${safeKey}`]: value
2976
- };
2977
- }, {})
2978
- }
2979
- };
2980
- stopwatch();
2981
- const context = {
2982
- options: resolvedOptions,
2983
- clean: userOptions.clean !== false,
2984
- workspaceConfig,
2985
- projectConfigurations,
2986
- projectName,
2987
- projectGraph,
2988
- sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
2989
- outputPath: resolvedOptions.outputPath || joinPaths(
2990
- workspaceConfig.workspaceRoot,
2991
- "dist",
2992
- resolvedOptions.projectRoot
2993
- ),
2994
- minify: resolvedOptions.minify || resolvedOptions.mode === "production"
2995
- };
2996
- context.options.esbuildPlugins = [...context.options.esbuildPlugins ?? []];
2997
- if (context.options.verbose) {
2998
- writeDebug(
2999
- ` \u2699\uFE0F Build options resolved:
2879
+ import fs from "node:fs";
2880
+ import { builtinModules } from "node:module";
2881
+ import path from "node:path";
2882
+ import _resolve from "resolve";
3000
2883
 
3001
- ${formatLogMessage(context.options)}`,
3002
- workspaceConfig
3003
- );
3004
- }
3005
- return context;
3006
- }
2884
+ // ../build-tools/src/plugins/type-definitions.ts
2885
+ init_esm_shims();
2886
+ import { stripIndents } from "@nx/devkit";
2887
+ import { relative as relative3 } from "path";
3007
2888
 
3008
- // ../esbuild/src/package-json.ts
2889
+ // ../build-tools/src/types.ts
3009
2890
  init_esm_shims();
3010
- import { writeJsonFile } from "@nx/devkit";
3011
- import { existsSync as existsSync7 } from "node:fs";
3012
- import hf2 from "node:fs/promises";
3013
- async function generatePackageJson(context) {
3014
- if (context.options.generatePackageJson !== false && existsSync7(joinPaths(context.options.projectRoot, "package.json"))) {
3015
- writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
3016
- const stopwatch = getStopwatch("Write package.json file");
3017
- const packageJsonPath = joinPaths(
3018
- context.options.projectRoot,
3019
- "project.json"
3020
- );
3021
- if (!existsSync7(packageJsonPath)) {
3022
- throw new Error("Cannot find package.json configuration");
3023
- }
3024
- const packageJsonFile = await hf2.readFile(
3025
- joinPaths(
3026
- context.workspaceConfig.workspaceRoot,
3027
- context.options.projectRoot,
3028
- "package.json"
3029
- ),
3030
- "utf8"
3031
- );
3032
- let packageJson = JSON.parse(packageJsonFile);
3033
- if (!packageJson) {
3034
- throw new Error("Cannot find package.json configuration file");
3035
- }
3036
- packageJson = await addPackageDependencies(
3037
- context.workspaceConfig.workspaceRoot,
3038
- context.options.projectRoot,
3039
- context.projectName,
3040
- packageJson
3041
- );
3042
- packageJson = await addWorkspacePackageJsonFields(
3043
- context.workspaceConfig,
3044
- context.options.projectRoot,
3045
- context.sourceRoot,
3046
- context.projectName,
3047
- false,
3048
- packageJson
3049
- );
3050
- if (context.options.entry) {
3051
- packageJson.exports ??= {};
3052
- packageJson.exports["./package.json"] ??= "./package.json";
3053
- const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
3054
- if (entryPoints.length > 0) {
3055
- const defaultEntry = entryPoints.includes("index") ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entryPoints[0]}`;
3056
- const isEsm = Array.isArray(context.options.format) ? context.options.format.includes("esm") : context.options.format === "esm";
3057
- const isCjs = Array.isArray(context.options.format) ? context.options.format.includes("cjs") : context.options.format === "cjs";
3058
- const isDts = context.options.dts || context.options.experimentalDts;
3059
- packageJson.exports["."] ??= `${defaultEntry}.${isEsm ? "mjs" : isCjs ? "cjs" : "js"}`;
3060
- for (const entryPoint of entryPoints) {
3061
- packageJson.exports[`./${entryPoint}`] ??= {};
3062
- if (isEsm) {
3063
- if (isDts) {
3064
- packageJson.exports[`./${entryPoint}`].import = {
3065
- types: `./dist/${entryPoint}.d.mts`,
3066
- default: `./dist/${entryPoint}.mjs`
3067
- };
3068
- } else {
3069
- packageJson.exports[`./${entryPoint}`].import = `./dist/${entryPoint}.mjs`;
3070
- }
3071
- if (isDts) {
3072
- packageJson.exports[`./${entryPoint}`].default = {
3073
- types: `./dist/${entryPoint}.d.mts`,
3074
- default: `./dist/${entryPoint}.mjs`
3075
- };
3076
- } else {
3077
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.mjs`;
3078
- }
3079
- }
3080
- if (isCjs) {
3081
- if (isDts) {
3082
- packageJson.exports[`./${entryPoint}`].require = {
3083
- types: `./dist/${entryPoint}.d.cts`,
3084
- default: `./dist/${entryPoint}.cjs`
3085
- };
3086
- } else {
3087
- packageJson.exports[`./${entryPoint}`].require = `./dist/${entryPoint}.cjs`;
3088
- }
3089
- if (!isEsm) {
3090
- if (isDts) {
3091
- packageJson.exports[`./${entryPoint}`].default = {
3092
- types: `./dist/${entryPoint}.d.cts`,
3093
- default: `./dist/${entryPoint}.cjs`
3094
- };
3095
- } else {
3096
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.cjs`;
3097
- }
3098
- }
3099
- }
3100
- if (!isEsm && !isCjs) {
3101
- if (isDts) {
3102
- packageJson.exports[`./${entryPoint}`].default = {
3103
- types: `./dist/${entryPoint}.d.ts`,
3104
- default: `./dist/${entryPoint}.js`
3105
- };
3106
- } else {
3107
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.js`;
3108
- }
3109
- }
3110
- }
3111
- if (isEsm) {
3112
- packageJson.module = `${defaultEntry}.mjs`;
3113
- } else {
3114
- packageJson.main = `${defaultEntry}.cjs`;
3115
- }
3116
- if (isDts) {
3117
- packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
3118
- }
3119
- packageJson.exports = Object.keys(packageJson.exports).reduce(
3120
- (ret, key) => {
3121
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
3122
- ret[key.replace("/index", "")] = packageJson.exports[key];
3123
- }
3124
- return ret;
3125
- },
3126
- packageJson.exports
3127
- );
3128
- }
3129
- }
3130
- await writeJsonFile(
3131
- joinPaths(context.outputPath, "package.json"),
3132
- packageJson
3133
- );
3134
- stopwatch();
3135
- }
3136
- return context;
3137
- }
3138
2891
 
3139
- // ../esbuild/src/tsup.ts
2892
+ // ../build-tools/src/utilities/index.ts
3140
2893
  init_esm_shims();
3141
2894
 
3142
- // ../tsup/src/index.ts
2895
+ // ../build-tools/src/utilities/copy-assets.ts
3143
2896
  init_esm_shims();
3144
- import { build as tsup } from "tsup";
3145
- async function build(options) {
3146
- if (!options.silent) {
3147
- writeDebug(
3148
- ` \u{1F680} Running ${options.name || "tsup"} build`,
3149
- options.workspaceConfig
3150
- );
2897
+ import { CopyAssetsHandler } from "@nx/js/internal";
2898
+ import { glob } from "glob";
2899
+ import { readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
2900
+ var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
2901
+ const pendingAssets = Array.from(assets ?? []);
2902
+ pendingAssets.push({
2903
+ input: projectRoot,
2904
+ glob: "*.md",
2905
+ output: "."
2906
+ });
2907
+ pendingAssets.push({
2908
+ input: ".",
2909
+ glob: "LICENSE",
2910
+ output: "."
2911
+ });
2912
+ if (generatePackageJson2 === false) {
2913
+ pendingAssets.push({
2914
+ input: projectRoot,
2915
+ glob: "package.json",
2916
+ output: "."
2917
+ });
3151
2918
  }
3152
- const stopwatch = getStopwatch(`${options.name || "tsup"} build`);
3153
- await tsup(options);
3154
- if (!options.silent) {
3155
- stopwatch();
2919
+ if (includeSrc === true) {
2920
+ pendingAssets.push({
2921
+ input: sourceRoot,
2922
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
2923
+ output: "src/"
2924
+ });
3156
2925
  }
3157
- }
3158
-
3159
- // ../esbuild/src/tsup.ts
3160
- async function executeTsup(context) {
3161
- writeDebug(
3162
- ` \u{1F680} Running ${context.options.name} build`,
3163
- context.workspaceConfig
2926
+ writeTrace(
2927
+ `\u{1F4DD} Copying the following assets to the output directory:
2928
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
2929
+ config
3164
2930
  );
3165
- const stopwatch = getStopwatch(`${context.options.name} build`);
3166
- await build({
3167
- ...context.options,
3168
- outDir: context.options.distDir ? joinPaths(context.outputPath, context.options.distDir) : context.outputPath,
3169
- workspaceConfig: context.workspaceConfig
2931
+ const assetHandler = new CopyAssetsHandler({
2932
+ projectDir: projectRoot,
2933
+ rootDir: config.workspaceRoot,
2934
+ outputDir: outputPath,
2935
+ assets: pendingAssets
3170
2936
  });
3171
- stopwatch();
3172
- return context;
3173
- }
3174
-
3175
- // ../esbuild/src/build.ts
3176
- async function reportResults(context) {
3177
- if (context.result?.errors.length === 0) {
3178
- if (context.result.warnings.length > 0) {
3179
- writeWarning(
3180
- ` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`,
3181
- context.workspaceConfig
3182
- );
3183
- }
3184
- writeSuccess(
3185
- ` \u{1F4E6} The ${context.options.name} build completed successfully`,
3186
- context.workspaceConfig
3187
- );
3188
- } else if (context.result?.errors && context.result?.errors.length > 0) {
3189
- writeError(
3190
- ` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`,
3191
- context.workspaceConfig
3192
- );
3193
- throw new Error(
3194
- `The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`
3195
- );
3196
- }
3197
- }
3198
- async function cleanOutputPath(context) {
3199
- if (context.clean !== false && context.outputPath) {
2937
+ await assetHandler.processAllAssetsOnce();
2938
+ writeTrace("Completed copying assets to the output directory", config);
2939
+ if (includeSrc === true) {
3200
2940
  writeDebug(
3201
- ` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`,
3202
- context.workspaceConfig
3203
- );
3204
- const stopwatch = getStopwatch(`${context.options.name} output clean`);
3205
- await cleanDirectories(context.outputPath);
3206
- stopwatch();
3207
- }
3208
- return context;
3209
- }
3210
- async function build2(options) {
3211
- writeDebug(` ${brandIcon()} Executing Storm ESBuild pipeline`);
3212
- const stopwatch = getStopwatch("ESBuild pipeline");
3213
- try {
3214
- const opts = Array.isArray(options) ? options : [options];
3215
- if (opts.length === 0) {
3216
- throw new Error("No build options were provided");
3217
- }
3218
- const context = await resolveContext(options);
3219
- await cleanOutputPath(context);
3220
- await Promise.all([
3221
- // dependencyCheck(context.options),
3222
- generatePackageJson(context),
3223
- copyBuildAssets(context),
3224
- executeTsup(context)
2941
+ `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
2942
+ outputPath,
2943
+ "src"
2944
+ )}`,
2945
+ config
2946
+ );
2947
+ const files = await glob([
2948
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
2949
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
2950
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
2951
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
3225
2952
  ]);
3226
- await reportResults(context);
3227
- writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
3228
- } catch (error) {
3229
- writeFatal(
3230
- "Fatal errors that the build process could not recover from have occured. The build process has been terminated."
2953
+ await Promise.allSettled(
2954
+ files.map(
2955
+ async (file) => writeFile5(
2956
+ file,
2957
+ `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
2958
+
2959
+ ${await readFile6(file, "utf8")}
2960
+
2961
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
2962
+ )
2963
+ )
3231
2964
  );
3232
- throw error;
3233
- } finally {
3234
- stopwatch();
3235
2965
  }
3236
- }
2966
+ };
3237
2967
 
3238
- // ../workspace-tools/src/executors/esbuild/executor.ts
3239
- async function esbuildExecutorFn(options, context, config) {
3240
- writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
3241
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
2968
+ // ../build-tools/src/utilities/generate-package-json.ts
2969
+ init_esm_shims();
2970
+ import { calculateProjectBuildableDependencies } from "@nx/js/internal";
2971
+ import { Glob } from "glob";
2972
+ import { existsSync as existsSync7, readFileSync as readFileSync3 } from "node:fs";
2973
+ import { readFile as readFile7 } from "node:fs/promises";
2974
+ import {
2975
+ createProjectGraphAsync as createProjectGraphAsync2,
2976
+ readCachedProjectGraph as readCachedProjectGraph2,
2977
+ readProjectsConfigurationFromProjectGraph
2978
+ } from "nx/src/project-graph/project-graph";
2979
+ var addPackageDependencies = async (workspaceRoot2, projectRoot, projectName, packageJson) => {
2980
+ let projectGraph;
2981
+ try {
2982
+ projectGraph = readCachedProjectGraph2();
2983
+ } catch {
2984
+ await createProjectGraphAsync2();
2985
+ projectGraph = readCachedProjectGraph2();
2986
+ }
2987
+ if (!projectGraph) {
3242
2988
  throw new Error(
3243
- "The Build process failed because the context is not valid. Please run this command from a workspace."
2989
+ "The Build process failed because the project graph is not available. Please run the build command again."
3244
2990
  );
3245
2991
  }
3246
- await build2({
3247
- ...options,
3248
- projectRoot: (
3249
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3250
- context.projectsConfigurations.projects?.[context.projectName].root
3251
- ),
3252
- name: context.projectName,
3253
- sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
3254
- format: options.format,
3255
- platform: options.platform
3256
- });
3257
- return {
3258
- success: true
3259
- };
3260
- }
3261
- var executor_default6 = withRunExecutor(
3262
- "Storm ESBuild build",
3263
- esbuildExecutorFn,
3264
- {
3265
- skipReadingConfig: false,
3266
- hooks: {
3267
- applyDefaultOptions: async (options) => {
3268
- options.entry ??= ["src/index.ts"];
3269
- options.outputPath ??= "dist/{projectRoot}";
3270
- options.tsconfig ??= "{projectRoot}/tsconfig.json";
3271
- return options;
2992
+ const projectDependencies = calculateProjectBuildableDependencies(
2993
+ void 0,
2994
+ projectGraph,
2995
+ workspaceRoot2,
2996
+ projectName,
2997
+ process.env.NX_TASK_TARGET_TARGET || "build",
2998
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
2999
+ true
3000
+ );
3001
+ const localPackages = [];
3002
+ for (const project of projectDependencies.dependencies.filter(
3003
+ (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot2
3004
+ )) {
3005
+ const projectNode = project.node;
3006
+ if (projectNode.data.root) {
3007
+ const projectPackageJsonPath = joinPaths(
3008
+ workspaceRoot2,
3009
+ projectNode.data.root,
3010
+ "package.json"
3011
+ );
3012
+ if (existsSync7(projectPackageJsonPath)) {
3013
+ const projectPackageJsonContent = await readFile7(
3014
+ projectPackageJsonPath,
3015
+ "utf8"
3016
+ );
3017
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
3018
+ if (projectPackageJson.private !== true) {
3019
+ localPackages.push(projectPackageJson);
3020
+ }
3272
3021
  }
3273
3022
  }
3274
3023
  }
3275
- );
3276
-
3277
- // ../workspace-tools/src/executors/napi/executor.ts
3278
- init_esm_shims();
3279
- import { createJiti } from "jiti";
3280
- import { fileExists } from "nx/src/utils/fileutils";
3281
- async function napiExecutor(options, context, config) {
3282
- const jiti = createJiti(config.workspaceRoot, {
3283
- fsCache: config.skipCache ? false : joinPaths(
3284
- config.workspaceRoot,
3285
- config.directories.cache || "node_modules/.cache/storm",
3286
- "jiti"
3287
- ),
3288
- interopDefault: true
3289
- });
3290
- const { NapiCli } = await jiti.import(
3291
- jiti.esmResolve("@napi-rs/cli")
3292
- );
3293
- if (!context.projectGraph?.nodes[context.projectName ?? ""]) {
3294
- throw new Error(
3295
- "The Napi Build process failed because the project could not be found in the project graph. Please run this command from a workspace root directory."
3024
+ if (localPackages.length > 0) {
3025
+ writeTrace(
3026
+ `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
3296
3027
  );
3297
- }
3298
- const projectRoot = context.projectGraph?.nodes[context.projectName ?? ""]?.data.root;
3299
- const packageJson = joinPaths(projectRoot ?? ".", "package.json");
3300
- if (!fileExists(packageJson)) {
3301
- throw new Error(`Could not find package.json at ${packageJson}`);
3302
- }
3303
- const napi = new NapiCli();
3304
- const normalizedOptions = { ...options };
3305
- const metadata = cargoMetadata();
3306
- normalizedOptions.targetDir = options.targetDir || metadata?.target_directory || joinPaths(config.workspaceRoot, "dist", "target");
3307
- normalizedOptions.outputDir = options.outputPath;
3308
- normalizedOptions.packageJsonPath ??= packageJson;
3309
- if (options.cwd) {
3310
- normalizedOptions.cwd = correctPaths(options.cwd);
3311
- } else {
3312
- const absoluteProjectRoot = correctPaths(
3313
- joinPaths(config.workspaceRoot, projectRoot || ".")
3028
+ const projectJsonFile = await readFile7(
3029
+ joinPaths(projectRoot, "project.json"),
3030
+ "utf8"
3314
3031
  );
3315
- normalizedOptions.cwd = absoluteProjectRoot;
3316
- if (normalizedOptions.outputDir) {
3317
- normalizedOptions.outputDir = relative(
3318
- normalizedOptions.cwd,
3319
- correctPaths(
3320
- isAbsolute(normalizedOptions.outputDir) ? normalizedOptions.outputDir : joinPaths(config.workspaceRoot, normalizedOptions.outputDir)
3321
- )
3322
- );
3323
- }
3324
- if (normalizedOptions.packageJsonPath) {
3325
- normalizedOptions.packageJsonPath = relative(
3326
- normalizedOptions.cwd,
3327
- correctPaths(
3328
- isAbsolute(normalizedOptions.packageJsonPath) ? normalizedOptions.packageJsonPath : joinPaths(config.workspaceRoot, normalizedOptions.packageJsonPath)
3329
- )
3330
- );
3331
- }
3332
- if (normalizedOptions.configPath) {
3333
- normalizedOptions.configPath = relative(
3334
- normalizedOptions.cwd,
3335
- correctPaths(
3336
- isAbsolute(normalizedOptions.configPath) ? normalizedOptions.configPath : joinPaths(config.workspaceRoot, normalizedOptions.configPath)
3337
- )
3338
- );
3339
- }
3340
- if (normalizedOptions.manifestPath) {
3341
- normalizedOptions.manifestPath = relative(
3342
- normalizedOptions.cwd,
3343
- correctPaths(
3344
- isAbsolute(normalizedOptions.manifestPath) ? normalizedOptions.manifestPath : joinPaths(config.workspaceRoot, normalizedOptions.manifestPath)
3345
- )
3032
+ const projectJson = JSON.parse(projectJsonFile);
3033
+ const projectName2 = projectJson.name;
3034
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
3035
+ if (!projectConfigurations?.projects?.[projectName2]) {
3036
+ throw new Error(
3037
+ "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."
3346
3038
  );
3347
3039
  }
3040
+ const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
3041
+ if (projectConfigurations.projects?.[dep]) {
3042
+ const depPackageJsonPath = joinPaths(
3043
+ workspaceRoot2,
3044
+ projectConfigurations.projects[dep].root,
3045
+ "package.json"
3046
+ );
3047
+ if (existsSync7(depPackageJsonPath)) {
3048
+ const depPackageJsonContent = readFileSync3(
3049
+ depPackageJsonPath,
3050
+ "utf8"
3051
+ );
3052
+ const depPackageJson = JSON.parse(depPackageJsonContent);
3053
+ if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
3054
+ ret.push(depPackageJson.name);
3055
+ }
3056
+ }
3057
+ }
3058
+ return ret;
3059
+ }, []);
3060
+ packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
3061
+ if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
3062
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
3063
+ }
3064
+ return ret;
3065
+ }, packageJson.dependencies ?? {});
3066
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
3067
+ if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
3068
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
3069
+ }
3070
+ return ret;
3071
+ }, packageJson.devDependencies ?? {});
3072
+ } else {
3073
+ writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
3348
3074
  }
3349
- if (process.env.VERCEL) {
3350
- return { success: true };
3351
- }
3352
- writeDebug(
3353
- `Normalized Napi Options:
3354
- packageJsonPath: ${normalizedOptions.packageJsonPath}
3355
- outputDir: ${normalizedOptions.outputDir}
3356
- targetDir: ${normalizedOptions.targetDir}
3357
- manifestPath: ${normalizedOptions.manifestPath}
3358
- configPath: ${normalizedOptions.configPath}
3359
- cwd: ${normalizedOptions.cwd}`,
3360
- config
3075
+ return packageJson;
3076
+ };
3077
+ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
3078
+ const workspaceRoot2 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
3079
+ const workspacePackageJsonContent = await readFile7(
3080
+ joinPaths(workspaceRoot2, "package.json"),
3081
+ "utf8"
3361
3082
  );
3362
- const { task } = await napi.build(normalizedOptions);
3363
- return { success: true, terminalOutput: await task };
3364
- }
3365
- var executor_default7 = withRunExecutor(
3366
- "Napi - Build Bindings",
3367
- napiExecutor,
3368
- {
3369
- skipReadingConfig: false,
3370
- hooks: {
3371
- applyDefaultOptions: (options) => {
3372
- options.outputPath ??= "{sourceRoot}";
3373
- options.toolchain ??= "stable";
3374
- options.dtsCache ??= true;
3375
- options.platform ??= true;
3376
- options.constEnum ??= false;
3377
- options.verbose ??= false;
3378
- options.jsBinding ??= "binding.js";
3379
- options.dts ??= "binding.d.ts";
3380
- return options;
3381
- }
3083
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
3084
+ packageJson.type ??= "module";
3085
+ packageJson.sideEffects ??= false;
3086
+ if (includeSrc === true) {
3087
+ let distSrc = sourceRoot.replace(projectRoot, "");
3088
+ if (distSrc.startsWith("/")) {
3089
+ distSrc = distSrc.substring(1);
3382
3090
  }
3091
+ packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
3383
3092
  }
3384
- );
3385
-
3386
- // ../workspace-tools/src/executors/npm-publish/executor.ts
3387
- init_esm_shims();
3388
-
3389
- // ../npm-tools/src/helpers/get-registry.ts
3390
- init_esm_shims();
3391
- import { exec } from "node:child_process";
3093
+ packageJson.files ??= ["dist/**/*"];
3094
+ if (includeSrc === true && !packageJson.files.includes("src")) {
3095
+ packageJson.files.push("src/**/*");
3096
+ }
3097
+ packageJson.publishConfig ??= {
3098
+ access: "public"
3099
+ };
3100
+ packageJson.description ??= workspacePackageJson.description;
3101
+ packageJson.homepage ??= workspacePackageJson.homepage;
3102
+ packageJson.bugs ??= workspacePackageJson.bugs;
3103
+ packageJson.license ??= workspacePackageJson.license;
3104
+ packageJson.keywords ??= workspacePackageJson.keywords;
3105
+ packageJson.funding ??= workspacePackageJson.funding;
3106
+ packageJson.author ??= workspacePackageJson.author;
3107
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
3108
+ if (!packageJson.maintainers && packageJson.author) {
3109
+ packageJson.maintainers = [packageJson.author];
3110
+ }
3111
+ packageJson.contributors ??= workspacePackageJson.contributors;
3112
+ if (!packageJson.contributors && packageJson.author) {
3113
+ packageJson.contributors = [packageJson.author];
3114
+ }
3115
+ packageJson.repository ??= workspacePackageJson.repository;
3116
+ packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
3117
+ return packageJson;
3118
+ };
3119
+ var addPackageJsonExport = (file, type = "module", sourceRoot) => {
3120
+ let entry = file.replaceAll("\\", "/");
3121
+ if (sourceRoot) {
3122
+ entry = entry.replace(sourceRoot, "");
3123
+ }
3124
+ return {
3125
+ import: {
3126
+ types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
3127
+ default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
3128
+ },
3129
+ require: {
3130
+ types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
3131
+ default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
3132
+ },
3133
+ default: {
3134
+ types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
3135
+ default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
3136
+ }
3137
+ };
3138
+ };
3392
3139
 
3393
- // ../npm-tools/src/constants.ts
3140
+ // ../build-tools/src/utilities/get-entry-points.ts
3394
3141
  init_esm_shims();
3142
+ import { glob as glob2 } from "glob";
3395
3143
 
3396
- // ../pnpm-tools/src/helpers/replace-deps-aliases.ts
3144
+ // ../build-tools/src/utilities/get-env.ts
3397
3145
  init_esm_shims();
3398
- import {
3399
- createProjectGraphAsync as createProjectGraphAsync3,
3400
- readCachedProjectGraph as readCachedProjectGraph2
3401
- } from "@nx/devkit";
3402
- import { existsSync as existsSync9 } from "node:fs";
3403
- import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
3404
- import { format } from "prettier";
3146
+ var getEnv = (builder, options) => {
3147
+ return {
3148
+ STORM_BUILD: builder,
3149
+ STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
3150
+ STORM_NAME: options.name,
3151
+ STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
3152
+ STORM_PLATFORM: options.platform,
3153
+ STORM_FORMAT: JSON.stringify(options.format),
3154
+ STORM_TARGET: JSON.stringify(options.target),
3155
+ ...options.env
3156
+ };
3157
+ };
3405
3158
 
3406
- // ../pnpm-tools/src/helpers/catalog.ts
3159
+ // ../build-tools/src/utilities/get-file-banner.ts
3407
3160
  init_esm_shims();
3408
3161
 
3409
- // ../npm-tools/src/helpers/get-version.ts
3162
+ // ../build-tools/src/utilities/get-out-extension.ts
3410
3163
  init_esm_shims();
3411
- import { exec as exec2 } from "node:child_process";
3412
- import { valid } from "semver";
3413
- import stripAnsi from "strip-ansi";
3414
-
3415
- // ../pnpm-tools/src/helpers/catalog.ts
3416
- import { coerce, gt, valid as valid2 } from "semver";
3417
3164
 
3418
- // ../pnpm-tools/src/helpers/format.ts
3165
+ // ../build-tools/src/utilities/get-project-deps.ts
3419
3166
  init_esm_shims();
3420
3167
 
3421
- // ../pnpm-tools/src/helpers/pnpm-workspace.ts
3168
+ // ../build-tools/src/utilities/read-nx-config.ts
3422
3169
  init_esm_shims();
3423
3170
  import { existsSync as existsSync8 } from "node:fs";
3424
- import { readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
3425
- import { parse, stringify } from "yaml";
3426
-
3427
- // ../workspace-tools/src/executors/npm-publish/executor.ts
3428
- import { execSync as execSync3 } from "node:child_process";
3429
- import { readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
3430
- import { format as format3 } from "prettier";
3431
-
3432
- // ../workspace-tools/src/utils/github.ts
3433
- init_esm_shims();
3434
- import { createJiti as createJiti2 } from "jiti";
3171
+ import { readFile as readFile8 } from "node:fs/promises";
3435
3172
 
3436
- // ../workspace-tools/src/utils/package-helpers.ts
3173
+ // ../build-tools/src/utilities/task-graph.ts
3437
3174
  init_esm_shims();
3438
3175
  import {
3439
- joinPathFragments as joinPathFragments3,
3440
- readJsonFile
3441
- } from "@nx/devkit";
3442
- import { execFileSync } from "child_process";
3443
- import { existsSync as existsSync10 } from "node:fs";
3444
- import { readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
3445
- import { dirname, resolve } from "path";
3446
- import { format as format2 } from "prettier";
3447
-
3448
- // ../workspace-tools/src/utils/project-tags.ts
3449
- init_esm_shims();
3450
-
3451
- // ../package-constants/src/tags.ts
3452
- init_esm_shims();
3453
- var ProjectTagConstants = {
3454
- Language: {
3455
- TAG_ID: "language",
3456
- TYPESCRIPT: "typescript",
3457
- RUST: "rust"
3458
- },
3459
- ProjectType: {
3460
- TAG_ID: "type",
3461
- LIBRARY: "library",
3462
- APPLICATION: "application"
3463
- },
3464
- ProjectLinking: {
3465
- TAG_ID: "project-linking",
3466
- REFERENCE: "reference",
3467
- ALIAS: "alias"
3468
- },
3469
- DistStyle: {
3470
- TAG_ID: "dist-style",
3471
- NORMAL: "normal",
3472
- CLEAN: "clean"
3473
- },
3474
- Provider: {
3475
- TAG_ID: "provider"
3476
- },
3477
- Platform: {
3478
- TAG_ID: "platform",
3479
- NODE: "node",
3480
- BROWSER: "browser",
3481
- NEUTRAL: "neutral",
3482
- WORKER: "worker"
3483
- },
3484
- Registry: {
3485
- TAG_ID: "registry",
3486
- CARGO: "cargo",
3487
- NPM: "npm",
3488
- CONTAINER: "container",
3489
- CYCLONE: "cyclone"
3490
- },
3491
- Plugin: {
3492
- TAG_ID: "plugin"
3493
- },
3494
- Builder: {
3495
- TAG_ID: "builder",
3496
- TSC: "tsc",
3497
- TSUP: "tsup",
3498
- TSDOWN: "tsdown",
3499
- VITE: "vite",
3500
- ROLLDOWN: "rolldown"
3501
- }
3502
- };
3503
- var formatProjectTag = (variant, value) => {
3504
- return `${variant}:${value}`;
3505
- };
3506
- var hasProjectTag = (project, variant) => {
3507
- project.tags = project.tags ?? [];
3508
- const prefix = formatProjectTag(variant, "");
3509
- return project.tags.some(
3510
- (tag) => tag.startsWith(prefix) && tag.length > prefix.length
3511
- );
3512
- };
3513
-
3514
- // ../workspace-tools/src/utils/project-tags.ts
3515
- var addProjectTag = (project, variant, value, options = {
3516
- overwrite: false
3517
- }) => {
3518
- project.tags = project.tags ?? [];
3519
- if (options.overwrite || !hasProjectTag(project, variant)) {
3520
- project.tags = project.tags.filter(
3521
- (tag) => !tag.startsWith(formatProjectTag(variant, ""))
3522
- );
3523
- project.tags.push(formatProjectTag(variant, value));
3524
- }
3525
- };
3526
-
3527
- // ../workspace-tools/src/executors/npm-publish/executor.ts
3528
- var LARGE_BUFFER2 = 1024 * 1e6;
3529
-
3530
- // ../workspace-tools/src/executors/size-limit/executor.ts
3531
- init_esm_shims();
3532
- import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
3533
- import esBuildPlugin from "@size-limit/esbuild";
3534
- import esBuildWhyPlugin from "@size-limit/esbuild-why";
3535
- import filePlugin from "@size-limit/file";
3536
- import sizeLimit from "size-limit";
3537
- async function sizeLimitExecutorFn(options, context, config) {
3538
- if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
3539
- throw new Error(
3540
- "The Size-Limit process failed because the context is not valid. Please run this command from a workspace."
3541
- );
3542
- }
3543
- writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
3544
- sizeLimit([filePlugin, esBuildPlugin, esBuildWhyPlugin], {
3545
- checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments4(
3546
- context.projectsConfigurations.projects[context.projectName]?.root ?? "./",
3547
- "src"
3548
- )
3549
- }).then((result) => {
3550
- writeInfo(
3551
- `\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`,
3552
- config
3553
- );
3554
- });
3555
- return {
3556
- success: true
3557
- };
3558
- }
3559
- var executor_default8 = withRunExecutor(
3560
- "Size-Limit Performance Test Executor",
3561
- sizeLimitExecutorFn,
3562
- {
3563
- skipReadingConfig: false,
3564
- hooks: {
3565
- applyDefaultOptions: (options) => {
3566
- return options;
3567
- }
3568
- }
3569
- }
3570
- );
3571
-
3572
- // ../workspace-tools/src/executors/tsdown/executor.ts
3573
- init_esm_shims();
3176
+ createTaskGraph,
3177
+ mapTargetDefaultsToDependencies
3178
+ } from "nx/src/tasks-runner/create-task-graph";
3574
3179
 
3575
3180
  // ../tsdown/src/build.ts
3576
- init_esm_shims();
3577
- import {
3578
- createProjectGraphAsync as createProjectGraphAsync4,
3579
- readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3,
3580
- writeJsonFile as writeJsonFile2
3581
- } from "@nx/devkit";
3582
- import defu5 from "defu";
3583
- import { existsSync as existsSync11 } from "node:fs";
3584
- import hf3 from "node:fs/promises";
3181
+ import defu4 from "defu";
3182
+ import { existsSync as existsSync9 } from "node:fs";
3183
+ import hf from "node:fs/promises";
3585
3184
  import { build as tsdown } from "tsdown";
3586
3185
 
3587
3186
  // ../tsdown/src/clean.ts
3588
3187
  init_esm_shims();
3589
- import { rm as rm2 } from "node:fs/promises";
3590
- async function cleanDirectories2(name = "TSDown", directory, config) {
3591
- await rm2(directory, { recursive: true, force: true });
3188
+ import { rm } from "node:fs/promises";
3189
+ async function cleanDirectories(name = "TSDown", directory, config) {
3190
+ await rm(directory, { recursive: true, force: true });
3592
3191
  }
3593
3192
 
3594
3193
  // ../tsdown/src/config.ts
@@ -3632,7 +3231,7 @@ var resolveOptions = async (userOptions) => {
3632
3231
  });
3633
3232
  writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
3634
3233
  const stopwatch = getStopwatch("Build options resolution");
3635
- const projectGraph = await createProjectGraphAsync4({
3234
+ const projectGraph = await createProjectGraphAsync3({
3636
3235
  exitOnError: true
3637
3236
  });
3638
3237
  const projectJsonPath = joinPaths(
@@ -3640,13 +3239,13 @@ var resolveOptions = async (userOptions) => {
3640
3239
  options.projectRoot,
3641
3240
  "project.json"
3642
3241
  );
3643
- if (!existsSync11(projectJsonPath)) {
3242
+ if (!existsSync9(projectJsonPath)) {
3644
3243
  throw new Error("Cannot find project.json configuration");
3645
3244
  }
3646
- const projectJsonFile = await hf3.readFile(projectJsonPath, "utf8");
3245
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
3647
3246
  const projectJson = JSON.parse(projectJsonFile);
3648
3247
  const projectName = projectJson.name;
3649
- const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
3248
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
3650
3249
  if (!projectConfigurations?.projects?.[projectName]) {
3651
3250
  throw new Error(
3652
3251
  "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."
@@ -3657,7 +3256,7 @@ var resolveOptions = async (userOptions) => {
3657
3256
  options.projectRoot,
3658
3257
  "package.json"
3659
3258
  );
3660
- if (!existsSync11(packageJsonPath)) {
3259
+ if (!existsSync9(packageJsonPath)) {
3661
3260
  throw new Error("Cannot find package.json configuration");
3662
3261
  }
3663
3262
  const debug = options.debug ?? (options.mode || workspaceConfig.mode) === "development";
@@ -3694,22 +3293,22 @@ var resolveOptions = async (userOptions) => {
3694
3293
  projectGraph,
3695
3294
  projectConfigurations
3696
3295
  };
3697
- result.env = defu5(
3296
+ result.env = defu4(
3698
3297
  options.env,
3699
3298
  getEnv("tsdown", result)
3700
3299
  );
3701
3300
  stopwatch();
3702
3301
  return result;
3703
3302
  };
3704
- async function generatePackageJson2(options) {
3705
- if (options.generatePackageJson !== false && existsSync11(joinPaths(options.projectRoot, "package.json"))) {
3303
+ async function generatePackageJson(options) {
3304
+ if (options.generatePackageJson !== false && existsSync9(joinPaths(options.projectRoot, "package.json"))) {
3706
3305
  writeDebug(" \u270D\uFE0F Writing package.json file", options.workspaceConfig);
3707
3306
  const stopwatch = getStopwatch("Write package.json file");
3708
3307
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
3709
- if (!existsSync11(packageJsonPath)) {
3308
+ if (!existsSync9(packageJsonPath)) {
3710
3309
  throw new Error("Cannot find package.json configuration");
3711
3310
  }
3712
- const packageJsonFile = await hf3.readFile(
3311
+ const packageJsonFile = await hf.readFile(
3713
3312
  joinPaths(
3714
3313
  options.workspaceConfig.workspaceRoot,
3715
3314
  options.projectRoot,
@@ -3772,7 +3371,7 @@ async function generatePackageJson2(options) {
3772
3371
  },
3773
3372
  packageJson.exports
3774
3373
  );
3775
- await writeJsonFile2(joinPaths(options.outDir, "package.json"), packageJson);
3374
+ await writeJsonFile(joinPaths(options.outDir, "package.json"), packageJson);
3776
3375
  stopwatch();
3777
3376
  }
3778
3377
  return options;
@@ -3788,7 +3387,7 @@ async function executeTSDown(options) {
3788
3387
  stopwatch();
3789
3388
  return options;
3790
3389
  }
3791
- async function copyBuildAssets2(options) {
3390
+ async function copyBuildAssets(options) {
3792
3391
  writeDebug(
3793
3392
  ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
3794
3393
  options.workspaceConfig
@@ -3806,20 +3405,20 @@ async function copyBuildAssets2(options) {
3806
3405
  stopwatch();
3807
3406
  return options;
3808
3407
  }
3809
- async function reportResults2(options) {
3408
+ async function reportResults(options) {
3810
3409
  writeSuccess(
3811
3410
  ` \u{1F4E6} The ${options.name} build completed successfully`,
3812
3411
  options.workspaceConfig
3813
3412
  );
3814
3413
  }
3815
- async function cleanOutputPath2(options) {
3414
+ async function cleanOutputPath(options) {
3816
3415
  if (options.clean !== false && options.workspaceConfig) {
3817
3416
  writeDebug(
3818
3417
  ` \u{1F9F9} Cleaning ${options.name} output path: ${options.workspaceConfig}`,
3819
3418
  options.workspaceConfig
3820
3419
  );
3821
3420
  const stopwatch = getStopwatch(`${options.name} output clean`);
3822
- await cleanDirectories2(
3421
+ await cleanDirectories(
3823
3422
  options.name,
3824
3423
  options.outDir,
3825
3424
  options.workspaceConfig
@@ -3828,7 +3427,7 @@ async function cleanOutputPath2(options) {
3828
3427
  }
3829
3428
  return options;
3830
3429
  }
3831
- async function build3(options) {
3430
+ async function build(options) {
3832
3431
  writeDebug(` ${brandIcon()} Executing Storm TSDown pipeline`);
3833
3432
  const stopwatch = getStopwatch("TSDown pipeline");
3834
3433
  try {
@@ -3840,13 +3439,13 @@ async function build3(options) {
3840
3439
  opts.map(async (opt) => await resolveOptions(opt))
3841
3440
  );
3842
3441
  if (resolved.length > 0) {
3843
- await cleanOutputPath2(resolved[0]);
3844
- await generatePackageJson2(resolved[0]);
3442
+ await cleanOutputPath(resolved[0]);
3443
+ await generatePackageJson(resolved[0]);
3845
3444
  await Promise.all(
3846
3445
  resolved.map(async (opt) => {
3847
3446
  await executeTSDown(opt);
3848
- await copyBuildAssets2(opt);
3849
- await reportResults2(opt);
3447
+ await copyBuildAssets(opt);
3448
+ await reportResults(opt);
3850
3449
  })
3851
3450
  );
3852
3451
  } else {
@@ -3873,7 +3472,7 @@ async function tsdownExecutorFn(options, context, config) {
3873
3472
  "The Build process failed because the context is not valid. Please run this command from a workspace."
3874
3473
  );
3875
3474
  }
3876
- await build3({
3475
+ await build({
3877
3476
  ...options,
3878
3477
  projectRoot: (
3879
3478
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -3946,8 +3545,8 @@ var executor_default10 = withRunExecutor(
3946
3545
 
3947
3546
  // ../workspace-tools/src/executors/unbuild/executor.ts
3948
3547
  init_esm_shims();
3949
- import { defu as defu6 } from "defu";
3950
- import { createJiti as createJiti3 } from "jiti";
3548
+ import { defu as defu5 } from "defu";
3549
+ import { createJiti as createJiti5 } from "jiti";
3951
3550
  async function unbuildExecutorFn(options, context, config) {
3952
3551
  writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
3953
3552
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
@@ -3965,7 +3564,7 @@ async function unbuildExecutorFn(options, context, config) {
3965
3564
  "The Build process failed because the project's source root is not valid. Please run this command from a workspace root directory."
3966
3565
  );
3967
3566
  }
3968
- const jiti = createJiti3(config.workspaceRoot, {
3567
+ const jiti = createJiti5(config.workspaceRoot, {
3969
3568
  fsCache: config.skipCache ? false : joinPaths(
3970
3569
  config.workspaceRoot,
3971
3570
  config.directories.cache || "node_modules/.cache/storm",
@@ -3977,7 +3576,7 @@ async function unbuildExecutorFn(options, context, config) {
3977
3576
  jiti.esmResolve("@storm-software/unbuild/build")
3978
3577
  );
3979
3578
  await stormUnbuild.build(
3980
- defu6(
3579
+ defu5(
3981
3580
  {
3982
3581
  ...options,
3983
3582
  projectRoot: context.projectsConfigurations.projects[context.projectName].root,
@@ -5381,7 +4980,7 @@ import {
5381
4980
  readJsonFile as readJsonFile2,
5382
4981
  workspaceRoot
5383
4982
  } from "@nx/devkit";
5384
- import { existsSync as existsSync12 } from "node:fs";
4983
+ import { existsSync as existsSync10 } from "node:fs";
5385
4984
  import { join as join4 } from "node:path";
5386
4985
  import {
5387
4986
  getNpmLockfileDependencies,
@@ -5654,8 +5253,8 @@ init_esm_shims();
5654
5253
  import {
5655
5254
  readJsonFile as readJsonFile3
5656
5255
  } from "@nx/devkit";
5657
- import defu7 from "defu";
5658
- import { existsSync as existsSync13 } from "node:fs";
5256
+ import defu6 from "defu";
5257
+ import { existsSync as existsSync11 } from "node:fs";
5659
5258
  import { dirname as dirname2, join as join5 } from "node:path";
5660
5259
 
5661
5260
  // ../workspace-tools/src/utils/typia-transform.ts