@storm-software/pulumi-tools 0.22.269 → 0.22.272

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-NO345UZJ.js → chunk-47LB7ZYL.js} +5 -5
  4. package/dist/{chunk-TXAB4NHC.mjs → chunk-6ON43AZF.mjs} +1 -1
  5. package/dist/{chunk-7GR34ULJ.mjs → chunk-DWFH4BRZ.mjs} +1 -1
  6. package/dist/{chunk-IYHI4LBK.js → chunk-EUXATBEX.js} +2 -2
  7. package/dist/{chunk-3VWSQ2SS.js → chunk-GURJDFFL.js} +394 -788
  8. package/dist/{chunk-FBP3JATY.mjs → chunk-HEW32ZR6.mjs} +1 -1
  9. package/dist/{chunk-Z4QP62US.mjs → chunk-LXRYYJKY.mjs} +1 -1
  10. package/dist/{chunk-NAYZFAPA.mjs → chunk-NJSYDEYC.mjs} +1 -1
  11. package/dist/{chunk-AWP77CXN.js → chunk-OQI5VWCB.js} +2 -2
  12. package/dist/{chunk-OZCLSR3Y.js → chunk-PNLQ6LFX.js} +2 -2
  13. package/dist/{chunk-H6I2VF55.mjs → chunk-RTKPAMXA.mjs} +1 -1
  14. package/dist/{chunk-2SVNRUZR.mjs → chunk-RZO6W5XG.mjs} +1 -1
  15. package/dist/{chunk-L3E6R4RK.js → chunk-T2TZMQMM.js} +2 -2
  16. package/dist/{chunk-U2C77EC7.mjs → chunk-UKY7WHEX.mjs} +1 -1
  17. package/dist/{chunk-GTZLRIOL.js → chunk-X4SSMSFG.js} +3 -3
  18. package/dist/{chunk-ZAWTV5HE.mjs → chunk-XFD2ITP3.mjs} +406 -800
  19. package/dist/{chunk-WTRYK6OF.js → chunk-Z4KKWVEO.js} +2 -2
  20. package/dist/executors.d.mts +1 -1
  21. package/dist/executors.d.ts +1 -1
  22. package/dist/executors.js +7 -7
  23. package/dist/executors.mjs +8 -8
  24. package/dist/generators.js +3 -3
  25. package/dist/generators.mjs +3 -3
  26. package/dist/index.d.mts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +9 -9
  29. package/dist/index.mjs +9 -9
  30. package/dist/src/base/base-executor.d.mts +1 -1
  31. package/dist/src/base/base-executor.d.ts +1 -1
  32. package/dist/src/base/base-executor.js +3 -3
  33. package/dist/src/base/base-executor.mjs +3 -3
  34. package/dist/src/base/index.d.mts +1 -1
  35. package/dist/src/base/index.d.ts +1 -1
  36. package/dist/src/base/index.js +3 -3
  37. package/dist/src/base/index.mjs +3 -3
  38. package/dist/src/base/providers.mjs +1 -1
  39. package/dist/src/executors/config/executor.d.mts +1 -1
  40. package/dist/src/executors/config/executor.d.ts +1 -1
  41. package/dist/src/executors/config/executor.js +4 -4
  42. package/dist/src/executors/config/executor.mjs +4 -4
  43. package/dist/src/executors/import/executor.d.mts +1 -1
  44. package/dist/src/executors/import/executor.d.ts +1 -1
  45. package/dist/src/executors/import/executor.js +4 -4
  46. package/dist/src/executors/import/executor.mjs +4 -4
  47. package/dist/src/executors/preview/executor.d.mts +1 -1
  48. package/dist/src/executors/preview/executor.d.ts +1 -1
  49. package/dist/src/executors/preview/executor.js +4 -4
  50. package/dist/src/executors/preview/executor.mjs +4 -4
  51. package/dist/src/executors/refresh/executor.d.mts +1 -1
  52. package/dist/src/executors/refresh/executor.d.ts +1 -1
  53. package/dist/src/executors/refresh/executor.js +4 -4
  54. package/dist/src/executors/refresh/executor.mjs +4 -4
  55. package/dist/src/executors/up/executor.d.mts +1 -1
  56. package/dist/src/executors/up/executor.d.ts +1 -1
  57. package/dist/src/executors/up/executor.js +4 -4
  58. package/dist/src/executors/up/executor.mjs +4 -4
  59. package/dist/src/generators/init/generator.js +3 -3
  60. package/dist/src/generators/init/generator.mjs +3 -3
  61. package/dist/src/lib/aws/index.mjs +1 -1
  62. package/dist/src/lib/aws/providers.mjs +1 -1
  63. package/dist/tsup.config.mjs +1 -1
  64. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __dirname
3
- } from "./chunk-7GR34ULJ.mjs";
3
+ } from "./chunk-DWFH4BRZ.mjs";
4
4
 
5
5
  // ../config-tools/src/utilities/run.ts
6
6
  import { exec, execSync } from "node:child_process";
@@ -2719,702 +2719,8 @@ import { readFileSync as readFileSync2 } from "node:fs";
2719
2719
  import https from "node:https";
2720
2720
  var LARGE_BUFFER2 = 1024 * 1e6;
2721
2721
 
2722
- // ../build-tools/src/config.ts
2723
- var DEFAULT_JS_BANNER = `
2724
- // ---------------------------------------
2725
- // \u{1F5F2} Built by Storm Software
2726
- // ---------------------------------------
2727
- `;
2728
- var DEFAULT_CSS_BANNER = `
2729
- /* ---------------------------------------
2730
- \u{1F5F2} Built by Storm Software
2731
- --------------------------------------- */
2732
- `;
2733
- var DEFAULT_ENVIRONMENT = "production";
2734
- var DEFAULT_TARGET = "esnext";
2735
- var DEFAULT_ORGANIZATION = "storm-software";
2736
-
2737
- // ../build-tools/src/plugins/swc.ts
2738
- import { transform } from "@swc/core";
2739
-
2740
- // ../build-tools/src/plugins/ts-resolve.ts
2741
- import fs from "node:fs";
2742
- import { builtinModules } from "node:module";
2743
- import path from "node:path";
2744
- import _resolve from "resolve";
2745
-
2746
- // ../build-tools/src/plugins/type-definitions.ts
2747
- import { stripIndents } from "@nx/devkit";
2748
- import { relative as relative3 } from "path";
2749
-
2750
- // ../build-tools/src/utilities/copy-assets.ts
2751
- import { CopyAssetsHandler } from "@nx/js/internal";
2752
- import { glob } from "glob";
2753
- import { readFile as readFile2, writeFile } from "node:fs/promises";
2754
- var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
2755
- const pendingAssets = Array.from(assets ?? []);
2756
- pendingAssets.push({
2757
- input: projectRoot,
2758
- glob: "*.md",
2759
- output: "."
2760
- });
2761
- pendingAssets.push({
2762
- input: ".",
2763
- glob: "LICENSE",
2764
- output: "."
2765
- });
2766
- if (generatePackageJson3 === false) {
2767
- pendingAssets.push({
2768
- input: projectRoot,
2769
- glob: "package.json",
2770
- output: "."
2771
- });
2772
- }
2773
- if (includeSrc === true) {
2774
- pendingAssets.push({
2775
- input: sourceRoot,
2776
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
2777
- output: "src/"
2778
- });
2779
- }
2780
- writeTrace(
2781
- `\u{1F4DD} Copying the following assets to the output directory:
2782
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
2783
- config
2784
- );
2785
- const assetHandler = new CopyAssetsHandler({
2786
- projectDir: projectRoot,
2787
- rootDir: config.workspaceRoot,
2788
- outputDir: outputPath,
2789
- assets: pendingAssets
2790
- });
2791
- await assetHandler.processAllAssetsOnce();
2792
- writeTrace("Completed copying assets to the output directory", config);
2793
- if (includeSrc === true) {
2794
- writeDebug(
2795
- `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
2796
- outputPath,
2797
- "src"
2798
- )}`,
2799
- config
2800
- );
2801
- const files = await glob([
2802
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
2803
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
2804
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
2805
- joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
2806
- ]);
2807
- await Promise.allSettled(
2808
- files.map(
2809
- async (file) => writeFile(
2810
- file,
2811
- `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
2812
-
2813
- ${await readFile2(file, "utf8")}
2814
-
2815
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
2816
- )
2817
- )
2818
- );
2819
- }
2820
- };
2821
-
2822
- // ../build-tools/src/utilities/generate-package-json.ts
2823
- import { calculateProjectBuildableDependencies } from "@nx/js/internal";
2824
- import { Glob } from "glob";
2825
- import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
2826
- import { readFile as readFile3 } from "node:fs/promises";
2827
- import {
2828
- createProjectGraphAsync,
2829
- readCachedProjectGraph,
2830
- readProjectsConfigurationFromProjectGraph
2831
- } from "nx/src/project-graph/project-graph";
2832
- var addPackageDependencies = async (workspaceRoot2, projectRoot, projectName, packageJson) => {
2833
- let projectGraph;
2834
- try {
2835
- projectGraph = readCachedProjectGraph();
2836
- } catch {
2837
- await createProjectGraphAsync();
2838
- projectGraph = readCachedProjectGraph();
2839
- }
2840
- if (!projectGraph) {
2841
- throw new Error(
2842
- "The Build process failed because the project graph is not available. Please run the build command again."
2843
- );
2844
- }
2845
- const projectDependencies = calculateProjectBuildableDependencies(
2846
- void 0,
2847
- projectGraph,
2848
- workspaceRoot2,
2849
- projectName,
2850
- process.env.NX_TASK_TARGET_TARGET || "build",
2851
- process.env.NX_TASK_TARGET_CONFIGURATION || "production",
2852
- true
2853
- );
2854
- const localPackages = [];
2855
- for (const project of projectDependencies.dependencies.filter(
2856
- (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot2
2857
- )) {
2858
- const projectNode = project.node;
2859
- if (projectNode.data.root) {
2860
- const projectPackageJsonPath = joinPaths(
2861
- workspaceRoot2,
2862
- projectNode.data.root,
2863
- "package.json"
2864
- );
2865
- if (existsSync4(projectPackageJsonPath)) {
2866
- const projectPackageJsonContent = await readFile3(
2867
- projectPackageJsonPath,
2868
- "utf8"
2869
- );
2870
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
2871
- if (projectPackageJson.private !== true) {
2872
- localPackages.push(projectPackageJson);
2873
- }
2874
- }
2875
- }
2876
- }
2877
- if (localPackages.length > 0) {
2878
- writeTrace(
2879
- `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
2880
- );
2881
- const projectJsonFile = await readFile3(
2882
- joinPaths(projectRoot, "project.json"),
2883
- "utf8"
2884
- );
2885
- const projectJson = JSON.parse(projectJsonFile);
2886
- const projectName2 = projectJson.name;
2887
- const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
2888
- if (!projectConfigurations?.projects?.[projectName2]) {
2889
- throw new Error(
2890
- "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."
2891
- );
2892
- }
2893
- const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
2894
- if (projectConfigurations.projects?.[dep]) {
2895
- const depPackageJsonPath = joinPaths(
2896
- workspaceRoot2,
2897
- projectConfigurations.projects[dep].root,
2898
- "package.json"
2899
- );
2900
- if (existsSync4(depPackageJsonPath)) {
2901
- const depPackageJsonContent = readFileSync3(
2902
- depPackageJsonPath,
2903
- "utf8"
2904
- );
2905
- const depPackageJson = JSON.parse(depPackageJsonContent);
2906
- if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
2907
- ret.push(depPackageJson.name);
2908
- }
2909
- }
2910
- }
2911
- return ret;
2912
- }, []);
2913
- packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
2914
- if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
2915
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
2916
- }
2917
- return ret;
2918
- }, packageJson.dependencies ?? {});
2919
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
2920
- if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
2921
- ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
2922
- }
2923
- return ret;
2924
- }, packageJson.devDependencies ?? {});
2925
- } else {
2926
- writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
2927
- }
2928
- return packageJson;
2929
- };
2930
- var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
2931
- const workspaceRoot2 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
2932
- const workspacePackageJsonContent = await readFile3(
2933
- joinPaths(workspaceRoot2, "package.json"),
2934
- "utf8"
2935
- );
2936
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
2937
- packageJson.type ??= "module";
2938
- packageJson.sideEffects ??= false;
2939
- if (includeSrc === true) {
2940
- let distSrc = sourceRoot.replace(projectRoot, "");
2941
- if (distSrc.startsWith("/")) {
2942
- distSrc = distSrc.substring(1);
2943
- }
2944
- packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
2945
- }
2946
- packageJson.files ??= ["dist/**/*"];
2947
- if (includeSrc === true && !packageJson.files.includes("src")) {
2948
- packageJson.files.push("src/**/*");
2949
- }
2950
- packageJson.publishConfig ??= {
2951
- access: "public"
2952
- };
2953
- packageJson.description ??= workspacePackageJson.description;
2954
- packageJson.homepage ??= workspacePackageJson.homepage;
2955
- packageJson.bugs ??= workspacePackageJson.bugs;
2956
- packageJson.license ??= workspacePackageJson.license;
2957
- packageJson.keywords ??= workspacePackageJson.keywords;
2958
- packageJson.funding ??= workspacePackageJson.funding;
2959
- packageJson.author ??= workspacePackageJson.author;
2960
- packageJson.maintainers ??= workspacePackageJson.maintainers;
2961
- if (!packageJson.maintainers && packageJson.author) {
2962
- packageJson.maintainers = [packageJson.author];
2963
- }
2964
- packageJson.contributors ??= workspacePackageJson.contributors;
2965
- if (!packageJson.contributors && packageJson.author) {
2966
- packageJson.contributors = [packageJson.author];
2967
- }
2968
- packageJson.repository ??= workspacePackageJson.repository;
2969
- packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
2970
- return packageJson;
2971
- };
2972
- var addPackageJsonExport = (file, type = "module", sourceRoot) => {
2973
- let entry = file.replaceAll("\\", "/");
2974
- if (sourceRoot) {
2975
- entry = entry.replace(sourceRoot, "");
2976
- }
2977
- return {
2978
- import: {
2979
- types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
2980
- default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
2981
- },
2982
- require: {
2983
- types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
2984
- default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
2985
- },
2986
- default: {
2987
- types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
2988
- default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
2989
- }
2990
- };
2991
- };
2992
-
2993
- // ../build-tools/src/utilities/get-entry-points.ts
2994
- import { glob as glob2 } from "glob";
2995
-
2996
- // ../build-tools/src/utilities/get-env.ts
2997
- var getEnv = (builder, options) => {
2998
- return {
2999
- STORM_BUILD: builder,
3000
- STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
3001
- STORM_NAME: options.name,
3002
- STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
3003
- STORM_PLATFORM: options.platform,
3004
- STORM_FORMAT: JSON.stringify(options.format),
3005
- STORM_TARGET: JSON.stringify(options.target),
3006
- ...options.env
3007
- };
3008
- };
3009
-
3010
- // ../build-tools/src/utilities/read-nx-config.ts
3011
- import { existsSync as existsSync5 } from "node:fs";
3012
- import { readFile as readFile4 } from "node:fs/promises";
3013
-
3014
- // ../build-tools/src/utilities/task-graph.ts
3015
- import {
3016
- createTaskGraph,
3017
- mapTargetDefaultsToDependencies
3018
- } from "nx/src/tasks-runner/create-task-graph";
3019
-
3020
- // ../esbuild/src/assets.ts
3021
- async function copyBuildAssets(context) {
3022
- if (!context.result?.errors.length && context.options.assets?.length) {
3023
- writeDebug(
3024
- ` \u{1F4CB} Copying ${context.options.assets.length} asset files to output directory: ${context.outputPath}`,
3025
- context.workspaceConfig
3026
- );
3027
- const stopwatch = getStopwatch(`${context.options.name} asset copy`);
3028
- await copyAssets(
3029
- context.workspaceConfig,
3030
- context.options.assets ?? [],
3031
- context.outputPath,
3032
- context.options.projectRoot,
3033
- context.sourceRoot,
3034
- true,
3035
- false
3036
- );
3037
- stopwatch();
3038
- }
3039
- return context;
3040
- }
3041
-
3042
- // ../esbuild/src/clean.ts
3043
- import { rm } from "node:fs/promises";
3044
- async function cleanDirectories(directory) {
3045
- await rm(directory, { recursive: true, force: true });
3046
- }
3047
-
3048
- // ../esbuild/src/context.ts
3049
- import {
3050
- createProjectGraphAsync as createProjectGraphAsync2,
3051
- readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2
3052
- } from "@nx/devkit";
3053
- import defu4 from "defu";
3054
- import { existsSync as existsSync6 } from "node:fs";
3055
- import hf from "node:fs/promises";
3056
- import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
3057
-
3058
- // ../esbuild/src/config.ts
3059
- var DEFAULT_BUILD_OPTIONS = {
3060
- platform: "node",
3061
- target: "node22",
3062
- format: "esm",
3063
- mode: "production",
3064
- generatePackageJson: true,
3065
- includeSrc: false,
3066
- keepNames: true,
3067
- metafile: false,
3068
- treeshake: true,
3069
- splitting: true,
3070
- shims: false,
3071
- watch: false,
3072
- bundle: true,
3073
- distDir: "dist",
3074
- loader: {
3075
- ".aac": "file",
3076
- ".css": "file",
3077
- ".eot": "file",
3078
- ".flac": "file",
3079
- ".gif": "file",
3080
- ".jpeg": "file",
3081
- ".jpg": "file",
3082
- ".mp3": "file",
3083
- ".mp4": "file",
3084
- ".ogg": "file",
3085
- ".otf": "file",
3086
- ".png": "file",
3087
- ".svg": "file",
3088
- ".ttf": "file",
3089
- ".wav": "file",
3090
- ".webm": "file",
3091
- ".webp": "file",
3092
- ".woff": "file",
3093
- ".woff2": "file"
3094
- },
3095
- banner: {
3096
- js: DEFAULT_JS_BANNER,
3097
- css: DEFAULT_CSS_BANNER
3098
- }
3099
- };
3100
-
3101
- // ../esbuild/src/context.ts
3102
- async function resolveContext(userOptions) {
3103
- const projectRoot = userOptions.projectRoot;
3104
- const workspaceRoot2 = findWorkspaceRoot2(projectRoot);
3105
- if (!workspaceRoot2) {
3106
- throw new Error("Cannot find Nx workspace root");
3107
- }
3108
- const workspaceConfig = await getWorkspaceConfig(true, {
3109
- workspaceRoot: workspaceRoot2.dir
3110
- });
3111
- writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
3112
- const stopwatch = getStopwatch("Build options resolution");
3113
- const projectGraph = await createProjectGraphAsync2({
3114
- exitOnError: true
3115
- });
3116
- const projectJsonPath = joinPaths(
3117
- workspaceRoot2.dir,
3118
- projectRoot,
3119
- "project.json"
3120
- );
3121
- if (!existsSync6(projectJsonPath)) {
3122
- throw new Error("Cannot find project.json configuration");
3123
- }
3124
- const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
3125
- const projectJson = JSON.parse(projectJsonFile);
3126
- const projectName = projectJson.name || userOptions.name;
3127
- const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
3128
- if (!projectConfigurations?.projects?.[projectName]) {
3129
- throw new Error(
3130
- "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."
3131
- );
3132
- }
3133
- const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
3134
- options.name ??= projectName;
3135
- const packageJsonPath = joinPaths(
3136
- workspaceRoot2.dir,
3137
- options.projectRoot,
3138
- "package.json"
3139
- );
3140
- if (!existsSync6(packageJsonPath)) {
3141
- throw new Error("Cannot find package.json configuration");
3142
- }
3143
- const env = getEnv("esbuild", options);
3144
- const define = defu4(options.define ?? {}, env ?? {});
3145
- const resolvedOptions = {
3146
- ...options,
3147
- tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths(workspaceRoot2.dir, projectRoot, "tsconfig.json"),
3148
- metafile: userOptions.mode === "development",
3149
- clean: false,
3150
- env,
3151
- define: {
3152
- STORM_FORMAT: JSON.stringify(options.format),
3153
- ...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
3154
- const value = JSON.stringify(define[key]);
3155
- const safeKey = key.replaceAll("(", "").replaceAll(")", "");
3156
- return {
3157
- ...res,
3158
- [`process.env.${safeKey}`]: value,
3159
- [`import.meta.env.${safeKey}`]: value
3160
- };
3161
- }, {})
3162
- }
3163
- };
3164
- stopwatch();
3165
- const context = {
3166
- options: resolvedOptions,
3167
- clean: userOptions.clean !== false,
3168
- workspaceConfig,
3169
- projectConfigurations,
3170
- projectName,
3171
- projectGraph,
3172
- sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
3173
- outputPath: resolvedOptions.outputPath || joinPaths(
3174
- workspaceConfig.workspaceRoot,
3175
- "dist",
3176
- resolvedOptions.projectRoot
3177
- ),
3178
- minify: resolvedOptions.minify || resolvedOptions.mode === "production"
3179
- };
3180
- context.options.esbuildPlugins = [...context.options.esbuildPlugins ?? []];
3181
- if (context.options.verbose) {
3182
- writeDebug(
3183
- ` \u2699\uFE0F Build options resolved:
3184
-
3185
- ${formatLogMessage(context.options)}`,
3186
- workspaceConfig
3187
- );
3188
- }
3189
- return context;
3190
- }
3191
-
3192
- // ../esbuild/src/package-json.ts
3193
- import { writeJsonFile } from "@nx/devkit";
3194
- import { existsSync as existsSync7 } from "node:fs";
3195
- import hf2 from "node:fs/promises";
3196
- async function generatePackageJson(context) {
3197
- if (context.options.generatePackageJson !== false && existsSync7(joinPaths(context.options.projectRoot, "package.json"))) {
3198
- writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
3199
- const stopwatch = getStopwatch("Write package.json file");
3200
- const packageJsonPath = joinPaths(
3201
- context.options.projectRoot,
3202
- "project.json"
3203
- );
3204
- if (!existsSync7(packageJsonPath)) {
3205
- throw new Error("Cannot find package.json configuration");
3206
- }
3207
- const packageJsonFile = await hf2.readFile(
3208
- joinPaths(
3209
- context.workspaceConfig.workspaceRoot,
3210
- context.options.projectRoot,
3211
- "package.json"
3212
- ),
3213
- "utf8"
3214
- );
3215
- let packageJson = JSON.parse(packageJsonFile);
3216
- if (!packageJson) {
3217
- throw new Error("Cannot find package.json configuration file");
3218
- }
3219
- packageJson = await addPackageDependencies(
3220
- context.workspaceConfig.workspaceRoot,
3221
- context.options.projectRoot,
3222
- context.projectName,
3223
- packageJson
3224
- );
3225
- packageJson = await addWorkspacePackageJsonFields(
3226
- context.workspaceConfig,
3227
- context.options.projectRoot,
3228
- context.sourceRoot,
3229
- context.projectName,
3230
- false,
3231
- packageJson
3232
- );
3233
- if (context.options.entry) {
3234
- packageJson.exports ??= {};
3235
- packageJson.exports["./package.json"] ??= "./package.json";
3236
- const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
3237
- if (entryPoints.length > 0) {
3238
- const defaultEntry = entryPoints.includes("index") ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entryPoints[0]}`;
3239
- const isEsm = Array.isArray(context.options.format) ? context.options.format.includes("esm") : context.options.format === "esm";
3240
- const isCjs = Array.isArray(context.options.format) ? context.options.format.includes("cjs") : context.options.format === "cjs";
3241
- const isDts = context.options.dts || context.options.experimentalDts;
3242
- packageJson.exports["."] ??= `${defaultEntry}.${isEsm ? "mjs" : isCjs ? "cjs" : "js"}`;
3243
- for (const entryPoint of entryPoints) {
3244
- packageJson.exports[`./${entryPoint}`] ??= {};
3245
- if (isEsm) {
3246
- if (isDts) {
3247
- packageJson.exports[`./${entryPoint}`].import = {
3248
- types: `./dist/${entryPoint}.d.mts`,
3249
- default: `./dist/${entryPoint}.mjs`
3250
- };
3251
- } else {
3252
- packageJson.exports[`./${entryPoint}`].import = `./dist/${entryPoint}.mjs`;
3253
- }
3254
- if (isDts) {
3255
- packageJson.exports[`./${entryPoint}`].default = {
3256
- types: `./dist/${entryPoint}.d.mts`,
3257
- default: `./dist/${entryPoint}.mjs`
3258
- };
3259
- } else {
3260
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.mjs`;
3261
- }
3262
- }
3263
- if (isCjs) {
3264
- if (isDts) {
3265
- packageJson.exports[`./${entryPoint}`].require = {
3266
- types: `./dist/${entryPoint}.d.cts`,
3267
- default: `./dist/${entryPoint}.cjs`
3268
- };
3269
- } else {
3270
- packageJson.exports[`./${entryPoint}`].require = `./dist/${entryPoint}.cjs`;
3271
- }
3272
- if (!isEsm) {
3273
- if (isDts) {
3274
- packageJson.exports[`./${entryPoint}`].default = {
3275
- types: `./dist/${entryPoint}.d.cts`,
3276
- default: `./dist/${entryPoint}.cjs`
3277
- };
3278
- } else {
3279
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.cjs`;
3280
- }
3281
- }
3282
- }
3283
- if (!isEsm && !isCjs) {
3284
- if (isDts) {
3285
- packageJson.exports[`./${entryPoint}`].default = {
3286
- types: `./dist/${entryPoint}.d.ts`,
3287
- default: `./dist/${entryPoint}.js`
3288
- };
3289
- } else {
3290
- packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.js`;
3291
- }
3292
- }
3293
- }
3294
- if (isEsm) {
3295
- packageJson.module = `${defaultEntry}.mjs`;
3296
- } else {
3297
- packageJson.main = `${defaultEntry}.cjs`;
3298
- }
3299
- if (isDts) {
3300
- packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
3301
- }
3302
- packageJson.exports = Object.keys(packageJson.exports).reduce(
3303
- (ret, key) => {
3304
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
3305
- ret[key.replace("/index", "")] = packageJson.exports[key];
3306
- }
3307
- return ret;
3308
- },
3309
- packageJson.exports
3310
- );
3311
- }
3312
- }
3313
- await writeJsonFile(
3314
- joinPaths(context.outputPath, "package.json"),
3315
- packageJson
3316
- );
3317
- stopwatch();
3318
- }
3319
- return context;
3320
- }
3321
-
3322
- // ../tsup/src/index.ts
3323
- import { build as tsup } from "tsup";
3324
- async function build(options) {
3325
- if (!options.silent) {
3326
- writeDebug(
3327
- ` \u{1F680} Running ${options.name || "tsup"} build`,
3328
- options.workspaceConfig
3329
- );
3330
- }
3331
- const stopwatch = getStopwatch(`${options.name || "tsup"} build`);
3332
- await tsup(options);
3333
- if (!options.silent) {
3334
- stopwatch();
3335
- }
3336
- }
3337
-
3338
- // ../esbuild/src/tsup.ts
3339
- async function executeTsup(context) {
3340
- writeDebug(
3341
- ` \u{1F680} Running ${context.options.name} build`,
3342
- context.workspaceConfig
3343
- );
3344
- const stopwatch = getStopwatch(`${context.options.name} build`);
3345
- await build({
3346
- ...context.options,
3347
- outDir: context.options.distDir ? joinPaths(context.outputPath, context.options.distDir) : context.outputPath,
3348
- workspaceConfig: context.workspaceConfig
3349
- });
3350
- stopwatch();
3351
- return context;
3352
- }
3353
-
3354
- // ../esbuild/src/build.ts
3355
- async function reportResults(context) {
3356
- if (context.result?.errors.length === 0) {
3357
- if (context.result.warnings.length > 0) {
3358
- writeWarning(
3359
- ` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`,
3360
- context.workspaceConfig
3361
- );
3362
- }
3363
- writeSuccess(
3364
- ` \u{1F4E6} The ${context.options.name} build completed successfully`,
3365
- context.workspaceConfig
3366
- );
3367
- } else if (context.result?.errors && context.result?.errors.length > 0) {
3368
- writeError(
3369
- ` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`,
3370
- context.workspaceConfig
3371
- );
3372
- throw new Error(
3373
- `The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`
3374
- );
3375
- }
3376
- }
3377
- async function cleanOutputPath(context) {
3378
- if (context.clean !== false && context.outputPath) {
3379
- writeDebug(
3380
- ` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`,
3381
- context.workspaceConfig
3382
- );
3383
- const stopwatch = getStopwatch(`${context.options.name} output clean`);
3384
- await cleanDirectories(context.outputPath);
3385
- stopwatch();
3386
- }
3387
- return context;
3388
- }
3389
- async function build2(options) {
3390
- writeDebug(` ${brandIcon()} Executing Storm ESBuild pipeline`);
3391
- const stopwatch = getStopwatch("ESBuild pipeline");
3392
- try {
3393
- const opts = Array.isArray(options) ? options : [options];
3394
- if (opts.length === 0) {
3395
- throw new Error("No build options were provided");
3396
- }
3397
- const context = await resolveContext(options);
3398
- await cleanOutputPath(context);
3399
- await Promise.all([
3400
- // dependencyCheck(context.options),
3401
- generatePackageJson(context),
3402
- copyBuildAssets(context),
3403
- executeTsup(context)
3404
- ]);
3405
- await reportResults(context);
3406
- writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
3407
- } catch (error) {
3408
- writeFatal(
3409
- "Fatal errors that the build process could not recover from have occured. The build process has been terminated."
3410
- );
3411
- throw error;
3412
- } finally {
3413
- stopwatch();
3414
- }
3415
- }
3416
-
3417
2722
  // ../workspace-tools/src/executors/esbuild/executor.ts
2723
+ import { createJiti } from "jiti";
3418
2724
  async function esbuildExecutorFn(options, context, config) {
3419
2725
  writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
3420
2726
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
@@ -3422,6 +2728,15 @@ async function esbuildExecutorFn(options, context, config) {
3422
2728
  "The Build process failed because the context is not valid. Please run this command from a workspace."
3423
2729
  );
3424
2730
  }
2731
+ const jiti = createJiti(config?.workspaceRoot || process.cwd(), {
2732
+ fsCache: config?.skipCache ? false : joinPaths(
2733
+ config?.workspaceRoot || process.cwd(),
2734
+ config?.directories?.cache || "node_modules/.cache/storm",
2735
+ "jiti"
2736
+ ),
2737
+ interopDefault: true
2738
+ });
2739
+ const { build: build2 } = await jiti.import(jiti.esmResolve("@storm-software/esbuild"));
3425
2740
  await build2({
3426
2741
  ...options,
3427
2742
  projectRoot: (
@@ -3454,10 +2769,10 @@ var executor_default6 = withRunExecutor(
3454
2769
  );
3455
2770
 
3456
2771
  // ../workspace-tools/src/executors/napi/executor.ts
3457
- import { createJiti } from "jiti";
2772
+ import { createJiti as createJiti2 } from "jiti";
3458
2773
  import { fileExists } from "nx/src/utils/fileutils";
3459
2774
  async function napiExecutor(options, context, config) {
3460
- const jiti = createJiti(config.workspaceRoot, {
2775
+ const jiti = createJiti2(config.workspaceRoot, {
3461
2776
  fsCache: config.skipCache ? false : joinPaths(
3462
2777
  config.workspaceRoot,
3463
2778
  config.directories.cache || "node_modules/.cache/storm",
@@ -3561,38 +2876,39 @@ var executor_default7 = withRunExecutor(
3561
2876
  }
3562
2877
  );
3563
2878
 
3564
- // ../npm-tools/src/helpers/get-registry.ts
3565
- import { exec as exec2 } from "node:child_process";
3566
-
3567
- // ../pnpm-tools/src/helpers/replace-deps-aliases.ts
3568
- import {
3569
- createProjectGraphAsync as createProjectGraphAsync3,
3570
- readCachedProjectGraph as readCachedProjectGraph2
3571
- } from "@nx/devkit";
3572
- import { existsSync as existsSync9 } from "node:fs";
3573
- import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
3574
- import { format } from "prettier";
3575
-
3576
2879
  // ../npm-tools/src/helpers/get-version.ts
3577
2880
  import { exec as exec3 } from "node:child_process";
3578
2881
  import { valid } from "semver";
3579
2882
  import stripAnsi from "strip-ansi";
3580
2883
 
2884
+ // ../npm-tools/src/helpers/get-registry.ts
2885
+ import { exec as exec2 } from "node:child_process";
2886
+
3581
2887
  // ../pnpm-tools/src/helpers/catalog.ts
3582
2888
  import { coerce, gt, valid as valid2 } from "semver";
3583
2889
 
3584
2890
  // ../pnpm-tools/src/helpers/pnpm-workspace.ts
3585
- import { existsSync as existsSync8 } from "node:fs";
3586
- import { readFile as readFile5, writeFile as writeFile2 } from "node:fs/promises";
2891
+ import { existsSync as existsSync4 } from "node:fs";
2892
+ import { readFile as readFile2, writeFile } from "node:fs/promises";
3587
2893
  import { parse, stringify } from "yaml";
3588
2894
 
2895
+ // ../pnpm-tools/src/helpers/replace-deps-aliases.ts
2896
+ import {
2897
+ createProjectGraphAsync,
2898
+ readCachedProjectGraph
2899
+ } from "@nx/devkit";
2900
+ import { existsSync as existsSync5 } from "node:fs";
2901
+ import { readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
2902
+ import { format } from "prettier";
2903
+
3589
2904
  // ../workspace-tools/src/executors/npm-publish/executor.ts
2905
+ import { createJiti as createJiti4 } from "jiti";
3590
2906
  import { execSync as execSync4 } from "node:child_process";
3591
- import { readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
2907
+ import { readFile as readFile5, writeFile as writeFile4 } from "node:fs/promises";
3592
2908
  import { format as format3 } from "prettier";
3593
2909
 
3594
2910
  // ../workspace-tools/src/utils/github.ts
3595
- import { createJiti as createJiti2 } from "jiti";
2911
+ import { createJiti as createJiti3 } from "jiti";
3596
2912
 
3597
2913
  // ../workspace-tools/src/utils/package-helpers.ts
3598
2914
  import {
@@ -3600,8 +2916,8 @@ import {
3600
2916
  readJsonFile
3601
2917
  } from "@nx/devkit";
3602
2918
  import { execFileSync } from "child_process";
3603
- import { existsSync as existsSync10 } from "node:fs";
3604
- import { readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
2919
+ import { existsSync as existsSync6 } from "node:fs";
2920
+ import { readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
3605
2921
  import { dirname, resolve as resolve2 } from "path";
3606
2922
  import { format as format2 } from "prettier";
3607
2923
 
@@ -3667,78 +2983,368 @@ var hasProjectTag = (project, variant) => {
3667
2983
  );
3668
2984
  };
3669
2985
 
3670
- // ../workspace-tools/src/utils/project-tags.ts
3671
- var addProjectTag = (project, variant, value, options = {
3672
- overwrite: false
3673
- }) => {
3674
- project.tags = project.tags ?? [];
3675
- if (options.overwrite || !hasProjectTag(project, variant)) {
3676
- project.tags = project.tags.filter(
3677
- (tag) => !tag.startsWith(formatProjectTag(variant, ""))
2986
+ // ../workspace-tools/src/utils/project-tags.ts
2987
+ var addProjectTag = (project, variant, value, options = {
2988
+ overwrite: false
2989
+ }) => {
2990
+ project.tags = project.tags ?? [];
2991
+ if (options.overwrite || !hasProjectTag(project, variant)) {
2992
+ project.tags = project.tags.filter(
2993
+ (tag) => !tag.startsWith(formatProjectTag(variant, ""))
2994
+ );
2995
+ project.tags.push(formatProjectTag(variant, value));
2996
+ }
2997
+ };
2998
+
2999
+ // ../workspace-tools/src/executors/npm-publish/executor.ts
3000
+ var LARGE_BUFFER3 = 1024 * 1e6;
3001
+
3002
+ // ../workspace-tools/src/executors/size-limit/executor.ts
3003
+ import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
3004
+ import esBuildPlugin from "@size-limit/esbuild";
3005
+ import esBuildWhyPlugin from "@size-limit/esbuild-why";
3006
+ import filePlugin from "@size-limit/file";
3007
+ import sizeLimit from "size-limit";
3008
+ async function sizeLimitExecutorFn(options, context, config) {
3009
+ if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
3010
+ throw new Error(
3011
+ "The Size-Limit process failed because the context is not valid. Please run this command from a workspace."
3012
+ );
3013
+ }
3014
+ writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
3015
+ sizeLimit([filePlugin, esBuildPlugin, esBuildWhyPlugin], {
3016
+ checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments4(
3017
+ context.projectsConfigurations.projects[context.projectName]?.root ?? "./",
3018
+ "src"
3019
+ )
3020
+ }).then((result) => {
3021
+ writeInfo(
3022
+ `\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`,
3023
+ config
3024
+ );
3025
+ });
3026
+ return {
3027
+ success: true
3028
+ };
3029
+ }
3030
+ var executor_default8 = withRunExecutor(
3031
+ "Size-Limit Performance Test Executor",
3032
+ sizeLimitExecutorFn,
3033
+ {
3034
+ skipReadingConfig: false,
3035
+ hooks: {
3036
+ applyDefaultOptions: (options) => {
3037
+ return options;
3038
+ }
3039
+ }
3040
+ }
3041
+ );
3042
+
3043
+ // ../tsdown/src/build.ts
3044
+ import {
3045
+ createProjectGraphAsync as createProjectGraphAsync3,
3046
+ readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2,
3047
+ writeJsonFile
3048
+ } from "@nx/devkit";
3049
+
3050
+ // ../build-tools/src/config.ts
3051
+ var DEFAULT_ENVIRONMENT = "production";
3052
+ var DEFAULT_TARGET = "esnext";
3053
+ var DEFAULT_ORGANIZATION = "storm-software";
3054
+
3055
+ // ../build-tools/src/plugins/swc.ts
3056
+ import { transform } from "@swc/core";
3057
+
3058
+ // ../build-tools/src/plugins/ts-resolve.ts
3059
+ import fs from "node:fs";
3060
+ import { builtinModules } from "node:module";
3061
+ import path from "node:path";
3062
+ import _resolve from "resolve";
3063
+
3064
+ // ../build-tools/src/plugins/type-definitions.ts
3065
+ import { stripIndents } from "@nx/devkit";
3066
+ import { relative as relative3 } from "path";
3067
+
3068
+ // ../build-tools/src/utilities/copy-assets.ts
3069
+ import { CopyAssetsHandler } from "@nx/js/internal";
3070
+ import { glob } from "glob";
3071
+ import { readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
3072
+ var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
3073
+ const pendingAssets = Array.from(assets ?? []);
3074
+ pendingAssets.push({
3075
+ input: projectRoot,
3076
+ glob: "*.md",
3077
+ output: "."
3078
+ });
3079
+ pendingAssets.push({
3080
+ input: ".",
3081
+ glob: "LICENSE",
3082
+ output: "."
3083
+ });
3084
+ if (generatePackageJson2 === false) {
3085
+ pendingAssets.push({
3086
+ input: projectRoot,
3087
+ glob: "package.json",
3088
+ output: "."
3089
+ });
3090
+ }
3091
+ if (includeSrc === true) {
3092
+ pendingAssets.push({
3093
+ input: sourceRoot,
3094
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
3095
+ output: "src/"
3096
+ });
3097
+ }
3098
+ writeTrace(
3099
+ `\u{1F4DD} Copying the following assets to the output directory:
3100
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
3101
+ config
3102
+ );
3103
+ const assetHandler = new CopyAssetsHandler({
3104
+ projectDir: projectRoot,
3105
+ rootDir: config.workspaceRoot,
3106
+ outputDir: outputPath,
3107
+ assets: pendingAssets
3108
+ });
3109
+ await assetHandler.processAllAssetsOnce();
3110
+ writeTrace("Completed copying assets to the output directory", config);
3111
+ if (includeSrc === true) {
3112
+ writeDebug(
3113
+ `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
3114
+ outputPath,
3115
+ "src"
3116
+ )}`,
3117
+ config
3118
+ );
3119
+ const files = await glob([
3120
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
3121
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
3122
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
3123
+ joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
3124
+ ]);
3125
+ await Promise.allSettled(
3126
+ files.map(
3127
+ async (file) => writeFile5(
3128
+ file,
3129
+ `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
3130
+
3131
+ ${await readFile6(file, "utf8")}
3132
+
3133
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
3134
+ )
3135
+ )
3678
3136
  );
3679
- project.tags.push(formatProjectTag(variant, value));
3680
3137
  }
3681
3138
  };
3682
3139
 
3683
- // ../workspace-tools/src/executors/npm-publish/executor.ts
3684
- var LARGE_BUFFER3 = 1024 * 1e6;
3685
-
3686
- // ../workspace-tools/src/executors/size-limit/executor.ts
3687
- import { joinPathFragments as joinPathFragments4 } from "@nx/devkit";
3688
- import esBuildPlugin from "@size-limit/esbuild";
3689
- import esBuildWhyPlugin from "@size-limit/esbuild-why";
3690
- import filePlugin from "@size-limit/file";
3691
- import sizeLimit from "size-limit";
3692
- async function sizeLimitExecutorFn(options, context, config) {
3693
- if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
3140
+ // ../build-tools/src/utilities/generate-package-json.ts
3141
+ import { calculateProjectBuildableDependencies } from "@nx/js/internal";
3142
+ import { Glob } from "glob";
3143
+ import { existsSync as existsSync7, readFileSync as readFileSync3 } from "node:fs";
3144
+ import { readFile as readFile7 } from "node:fs/promises";
3145
+ import {
3146
+ createProjectGraphAsync as createProjectGraphAsync2,
3147
+ readCachedProjectGraph as readCachedProjectGraph2,
3148
+ readProjectsConfigurationFromProjectGraph
3149
+ } from "nx/src/project-graph/project-graph";
3150
+ var addPackageDependencies = async (workspaceRoot2, projectRoot, projectName, packageJson) => {
3151
+ let projectGraph;
3152
+ try {
3153
+ projectGraph = readCachedProjectGraph2();
3154
+ } catch {
3155
+ await createProjectGraphAsync2();
3156
+ projectGraph = readCachedProjectGraph2();
3157
+ }
3158
+ if (!projectGraph) {
3694
3159
  throw new Error(
3695
- "The Size-Limit process failed because the context is not valid. Please run this command from a workspace."
3160
+ "The Build process failed because the project graph is not available. Please run the build command again."
3696
3161
  );
3697
3162
  }
3698
- writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
3699
- sizeLimit([filePlugin, esBuildPlugin, esBuildWhyPlugin], {
3700
- checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments4(
3701
- context.projectsConfigurations.projects[context.projectName]?.root ?? "./",
3702
- "src"
3703
- )
3704
- }).then((result) => {
3705
- writeInfo(
3706
- `\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`,
3707
- config
3163
+ const projectDependencies = calculateProjectBuildableDependencies(
3164
+ void 0,
3165
+ projectGraph,
3166
+ workspaceRoot2,
3167
+ projectName,
3168
+ process.env.NX_TASK_TARGET_TARGET || "build",
3169
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
3170
+ true
3171
+ );
3172
+ const localPackages = [];
3173
+ for (const project of projectDependencies.dependencies.filter(
3174
+ (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot2
3175
+ )) {
3176
+ const projectNode = project.node;
3177
+ if (projectNode.data.root) {
3178
+ const projectPackageJsonPath = joinPaths(
3179
+ workspaceRoot2,
3180
+ projectNode.data.root,
3181
+ "package.json"
3182
+ );
3183
+ if (existsSync7(projectPackageJsonPath)) {
3184
+ const projectPackageJsonContent = await readFile7(
3185
+ projectPackageJsonPath,
3186
+ "utf8"
3187
+ );
3188
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
3189
+ if (projectPackageJson.private !== true) {
3190
+ localPackages.push(projectPackageJson);
3191
+ }
3192
+ }
3193
+ }
3194
+ }
3195
+ if (localPackages.length > 0) {
3196
+ writeTrace(
3197
+ `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
3708
3198
  );
3709
- });
3710
- return {
3711
- success: true
3712
- };
3713
- }
3714
- var executor_default8 = withRunExecutor(
3715
- "Size-Limit Performance Test Executor",
3716
- sizeLimitExecutorFn,
3717
- {
3718
- skipReadingConfig: false,
3719
- hooks: {
3720
- applyDefaultOptions: (options) => {
3721
- return options;
3199
+ const projectJsonFile = await readFile7(
3200
+ joinPaths(projectRoot, "project.json"),
3201
+ "utf8"
3202
+ );
3203
+ const projectJson = JSON.parse(projectJsonFile);
3204
+ const projectName2 = projectJson.name;
3205
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
3206
+ if (!projectConfigurations?.projects?.[projectName2]) {
3207
+ throw new Error(
3208
+ "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."
3209
+ );
3210
+ }
3211
+ const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
3212
+ if (projectConfigurations.projects?.[dep]) {
3213
+ const depPackageJsonPath = joinPaths(
3214
+ workspaceRoot2,
3215
+ projectConfigurations.projects[dep].root,
3216
+ "package.json"
3217
+ );
3218
+ if (existsSync7(depPackageJsonPath)) {
3219
+ const depPackageJsonContent = readFileSync3(
3220
+ depPackageJsonPath,
3221
+ "utf8"
3222
+ );
3223
+ const depPackageJson = JSON.parse(depPackageJsonContent);
3224
+ if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
3225
+ ret.push(depPackageJson.name);
3226
+ }
3227
+ }
3228
+ }
3229
+ return ret;
3230
+ }, []);
3231
+ packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
3232
+ if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
3233
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
3234
+ }
3235
+ return ret;
3236
+ }, packageJson.dependencies ?? {});
3237
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
3238
+ if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
3239
+ ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
3722
3240
  }
3241
+ return ret;
3242
+ }, packageJson.devDependencies ?? {});
3243
+ } else {
3244
+ writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
3245
+ }
3246
+ return packageJson;
3247
+ };
3248
+ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
3249
+ const workspaceRoot2 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
3250
+ const workspacePackageJsonContent = await readFile7(
3251
+ joinPaths(workspaceRoot2, "package.json"),
3252
+ "utf8"
3253
+ );
3254
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
3255
+ packageJson.type ??= "module";
3256
+ packageJson.sideEffects ??= false;
3257
+ if (includeSrc === true) {
3258
+ let distSrc = sourceRoot.replace(projectRoot, "");
3259
+ if (distSrc.startsWith("/")) {
3260
+ distSrc = distSrc.substring(1);
3723
3261
  }
3262
+ packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
3724
3263
  }
3725
- );
3264
+ packageJson.files ??= ["dist/**/*"];
3265
+ if (includeSrc === true && !packageJson.files.includes("src")) {
3266
+ packageJson.files.push("src/**/*");
3267
+ }
3268
+ packageJson.publishConfig ??= {
3269
+ access: "public"
3270
+ };
3271
+ packageJson.description ??= workspacePackageJson.description;
3272
+ packageJson.homepage ??= workspacePackageJson.homepage;
3273
+ packageJson.bugs ??= workspacePackageJson.bugs;
3274
+ packageJson.license ??= workspacePackageJson.license;
3275
+ packageJson.keywords ??= workspacePackageJson.keywords;
3276
+ packageJson.funding ??= workspacePackageJson.funding;
3277
+ packageJson.author ??= workspacePackageJson.author;
3278
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
3279
+ if (!packageJson.maintainers && packageJson.author) {
3280
+ packageJson.maintainers = [packageJson.author];
3281
+ }
3282
+ packageJson.contributors ??= workspacePackageJson.contributors;
3283
+ if (!packageJson.contributors && packageJson.author) {
3284
+ packageJson.contributors = [packageJson.author];
3285
+ }
3286
+ packageJson.repository ??= workspacePackageJson.repository;
3287
+ packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
3288
+ return packageJson;
3289
+ };
3290
+ var addPackageJsonExport = (file, type = "module", sourceRoot) => {
3291
+ let entry = file.replaceAll("\\", "/");
3292
+ if (sourceRoot) {
3293
+ entry = entry.replace(sourceRoot, "");
3294
+ }
3295
+ return {
3296
+ import: {
3297
+ types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
3298
+ default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
3299
+ },
3300
+ require: {
3301
+ types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
3302
+ default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
3303
+ },
3304
+ default: {
3305
+ types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
3306
+ default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
3307
+ }
3308
+ };
3309
+ };
3726
3310
 
3727
- // ../tsdown/src/build.ts
3311
+ // ../build-tools/src/utilities/get-entry-points.ts
3312
+ import { glob as glob2 } from "glob";
3313
+
3314
+ // ../build-tools/src/utilities/get-env.ts
3315
+ var getEnv = (builder, options) => {
3316
+ return {
3317
+ STORM_BUILD: builder,
3318
+ STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
3319
+ STORM_NAME: options.name,
3320
+ STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
3321
+ STORM_PLATFORM: options.platform,
3322
+ STORM_FORMAT: JSON.stringify(options.format),
3323
+ STORM_TARGET: JSON.stringify(options.target),
3324
+ ...options.env
3325
+ };
3326
+ };
3327
+
3328
+ // ../build-tools/src/utilities/read-nx-config.ts
3329
+ import { existsSync as existsSync8 } from "node:fs";
3330
+ import { readFile as readFile8 } from "node:fs/promises";
3331
+
3332
+ // ../build-tools/src/utilities/task-graph.ts
3728
3333
  import {
3729
- createProjectGraphAsync as createProjectGraphAsync4,
3730
- readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph3,
3731
- writeJsonFile as writeJsonFile2
3732
- } from "@nx/devkit";
3733
- import defu5 from "defu";
3734
- import { existsSync as existsSync11 } from "node:fs";
3735
- import hf3 from "node:fs/promises";
3334
+ createTaskGraph,
3335
+ mapTargetDefaultsToDependencies
3336
+ } from "nx/src/tasks-runner/create-task-graph";
3337
+
3338
+ // ../tsdown/src/build.ts
3339
+ import defu4 from "defu";
3340
+ import { existsSync as existsSync9 } from "node:fs";
3341
+ import hf from "node:fs/promises";
3736
3342
  import { build as tsdown } from "tsdown";
3737
3343
 
3738
3344
  // ../tsdown/src/clean.ts
3739
- import { rm as rm2 } from "node:fs/promises";
3740
- async function cleanDirectories2(name = "TSDown", directory, config) {
3741
- await rm2(directory, { recursive: true, force: true });
3345
+ import { rm } from "node:fs/promises";
3346
+ async function cleanDirectories(name = "TSDown", directory, config) {
3347
+ await rm(directory, { recursive: true, force: true });
3742
3348
  }
3743
3349
 
3744
3350
  // ../tsdown/src/config.ts
@@ -3781,7 +3387,7 @@ var resolveOptions = async (userOptions) => {
3781
3387
  });
3782
3388
  writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
3783
3389
  const stopwatch = getStopwatch("Build options resolution");
3784
- const projectGraph = await createProjectGraphAsync4({
3390
+ const projectGraph = await createProjectGraphAsync3({
3785
3391
  exitOnError: true
3786
3392
  });
3787
3393
  const projectJsonPath = joinPaths(
@@ -3789,13 +3395,13 @@ var resolveOptions = async (userOptions) => {
3789
3395
  options.projectRoot,
3790
3396
  "project.json"
3791
3397
  );
3792
- if (!existsSync11(projectJsonPath)) {
3398
+ if (!existsSync9(projectJsonPath)) {
3793
3399
  throw new Error("Cannot find project.json configuration");
3794
3400
  }
3795
- const projectJsonFile = await hf3.readFile(projectJsonPath, "utf8");
3401
+ const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
3796
3402
  const projectJson = JSON.parse(projectJsonFile);
3797
3403
  const projectName = projectJson.name;
3798
- const projectConfigurations = readProjectsConfigurationFromProjectGraph3(projectGraph);
3404
+ const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
3799
3405
  if (!projectConfigurations?.projects?.[projectName]) {
3800
3406
  throw new Error(
3801
3407
  "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."
@@ -3806,7 +3412,7 @@ var resolveOptions = async (userOptions) => {
3806
3412
  options.projectRoot,
3807
3413
  "package.json"
3808
3414
  );
3809
- if (!existsSync11(packageJsonPath)) {
3415
+ if (!existsSync9(packageJsonPath)) {
3810
3416
  throw new Error("Cannot find package.json configuration");
3811
3417
  }
3812
3418
  const debug = options.debug ?? (options.mode || workspaceConfig.mode) === "development";
@@ -3843,22 +3449,22 @@ var resolveOptions = async (userOptions) => {
3843
3449
  projectGraph,
3844
3450
  projectConfigurations
3845
3451
  };
3846
- result.env = defu5(
3452
+ result.env = defu4(
3847
3453
  options.env,
3848
3454
  getEnv("tsdown", result)
3849
3455
  );
3850
3456
  stopwatch();
3851
3457
  return result;
3852
3458
  };
3853
- async function generatePackageJson2(options) {
3854
- if (options.generatePackageJson !== false && existsSync11(joinPaths(options.projectRoot, "package.json"))) {
3459
+ async function generatePackageJson(options) {
3460
+ if (options.generatePackageJson !== false && existsSync9(joinPaths(options.projectRoot, "package.json"))) {
3855
3461
  writeDebug(" \u270D\uFE0F Writing package.json file", options.workspaceConfig);
3856
3462
  const stopwatch = getStopwatch("Write package.json file");
3857
3463
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
3858
- if (!existsSync11(packageJsonPath)) {
3464
+ if (!existsSync9(packageJsonPath)) {
3859
3465
  throw new Error("Cannot find package.json configuration");
3860
3466
  }
3861
- const packageJsonFile = await hf3.readFile(
3467
+ const packageJsonFile = await hf.readFile(
3862
3468
  joinPaths(
3863
3469
  options.workspaceConfig.workspaceRoot,
3864
3470
  options.projectRoot,
@@ -3921,7 +3527,7 @@ async function generatePackageJson2(options) {
3921
3527
  },
3922
3528
  packageJson.exports
3923
3529
  );
3924
- await writeJsonFile2(joinPaths(options.outDir, "package.json"), packageJson);
3530
+ await writeJsonFile(joinPaths(options.outDir, "package.json"), packageJson);
3925
3531
  stopwatch();
3926
3532
  }
3927
3533
  return options;
@@ -3937,7 +3543,7 @@ async function executeTSDown(options) {
3937
3543
  stopwatch();
3938
3544
  return options;
3939
3545
  }
3940
- async function copyBuildAssets2(options) {
3546
+ async function copyBuildAssets(options) {
3941
3547
  writeDebug(
3942
3548
  ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
3943
3549
  options.workspaceConfig
@@ -3955,20 +3561,20 @@ async function copyBuildAssets2(options) {
3955
3561
  stopwatch();
3956
3562
  return options;
3957
3563
  }
3958
- async function reportResults2(options) {
3564
+ async function reportResults(options) {
3959
3565
  writeSuccess(
3960
3566
  ` \u{1F4E6} The ${options.name} build completed successfully`,
3961
3567
  options.workspaceConfig
3962
3568
  );
3963
3569
  }
3964
- async function cleanOutputPath2(options) {
3570
+ async function cleanOutputPath(options) {
3965
3571
  if (options.clean !== false && options.workspaceConfig) {
3966
3572
  writeDebug(
3967
3573
  ` \u{1F9F9} Cleaning ${options.name} output path: ${options.workspaceConfig}`,
3968
3574
  options.workspaceConfig
3969
3575
  );
3970
3576
  const stopwatch = getStopwatch(`${options.name} output clean`);
3971
- await cleanDirectories2(
3577
+ await cleanDirectories(
3972
3578
  options.name,
3973
3579
  options.outDir,
3974
3580
  options.workspaceConfig
@@ -3977,7 +3583,7 @@ async function cleanOutputPath2(options) {
3977
3583
  }
3978
3584
  return options;
3979
3585
  }
3980
- async function build3(options) {
3586
+ async function build(options) {
3981
3587
  writeDebug(` ${brandIcon()} Executing Storm TSDown pipeline`);
3982
3588
  const stopwatch = getStopwatch("TSDown pipeline");
3983
3589
  try {
@@ -3989,13 +3595,13 @@ async function build3(options) {
3989
3595
  opts.map(async (opt) => await resolveOptions(opt))
3990
3596
  );
3991
3597
  if (resolved.length > 0) {
3992
- await cleanOutputPath2(resolved[0]);
3993
- await generatePackageJson2(resolved[0]);
3598
+ await cleanOutputPath(resolved[0]);
3599
+ await generatePackageJson(resolved[0]);
3994
3600
  await Promise.all(
3995
3601
  resolved.map(async (opt) => {
3996
3602
  await executeTSDown(opt);
3997
- await copyBuildAssets2(opt);
3998
- await reportResults2(opt);
3603
+ await copyBuildAssets(opt);
3604
+ await reportResults(opt);
3999
3605
  })
4000
3606
  );
4001
3607
  } else {
@@ -4022,7 +3628,7 @@ async function tsdownExecutorFn(options, context, config) {
4022
3628
  "The Build process failed because the context is not valid. Please run this command from a workspace."
4023
3629
  );
4024
3630
  }
4025
- await build3({
3631
+ await build({
4026
3632
  ...options,
4027
3633
  projectRoot: (
4028
3634
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -4093,8 +3699,8 @@ var executor_default10 = withRunExecutor(
4093
3699
  );
4094
3700
 
4095
3701
  // ../workspace-tools/src/executors/unbuild/executor.ts
4096
- import { defu as defu6 } from "defu";
4097
- import { createJiti as createJiti3 } from "jiti";
3702
+ import { defu as defu5 } from "defu";
3703
+ import { createJiti as createJiti5 } from "jiti";
4098
3704
  async function unbuildExecutorFn(options, context, config) {
4099
3705
  writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
4100
3706
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
@@ -4112,7 +3718,7 @@ async function unbuildExecutorFn(options, context, config) {
4112
3718
  "The Build process failed because the project's source root is not valid. Please run this command from a workspace root directory."
4113
3719
  );
4114
3720
  }
4115
- const jiti = createJiti3(config.workspaceRoot, {
3721
+ const jiti = createJiti5(config.workspaceRoot, {
4116
3722
  fsCache: config.skipCache ? false : joinPaths(
4117
3723
  config.workspaceRoot,
4118
3724
  config.directories.cache || "node_modules/.cache/storm",
@@ -4124,7 +3730,7 @@ async function unbuildExecutorFn(options, context, config) {
4124
3730
  jiti.esmResolve("@storm-software/unbuild/build")
4125
3731
  );
4126
3732
  await stormUnbuild.build(
4127
- defu6(
3733
+ defu5(
4128
3734
  {
4129
3735
  ...options,
4130
3736
  projectRoot: context.projectsConfigurations.projects[context.projectName].root,
@@ -5374,7 +4980,7 @@ import {
5374
4980
  readJsonFile as readJsonFile2,
5375
4981
  workspaceRoot
5376
4982
  } from "@nx/devkit";
5377
- import { existsSync as existsSync12 } from "node:fs";
4983
+ import { existsSync as existsSync10 } from "node:fs";
5378
4984
  import { join as join4 } from "node:path";
5379
4985
  import {
5380
4986
  getNpmLockfileDependencies,
@@ -5643,8 +5249,8 @@ var RELEASE = recommended_default.release;
5643
5249
  import {
5644
5250
  readJsonFile as readJsonFile3
5645
5251
  } from "@nx/devkit";
5646
- import defu7 from "defu";
5647
- import { existsSync as existsSync13 } from "node:fs";
5252
+ import defu6 from "defu";
5253
+ import { existsSync as existsSync11 } from "node:fs";
5648
5254
  import { dirname as dirname2, join as join5 } from "node:path";
5649
5255
 
5650
5256
  // ../workspace-tools/src/utils/typia-transform.ts