npm package diff

Package: @forge/bundler

Versions: 6.1.4-next.0 - 6.1.4-next.1

Added: package/out/metadata.js

Added: package/out/metadata.d.ts.map

Added: package/out/metadata.d.ts

Modified: package/out/index.js

Index: package/out/index.js
===================================================================
--- package/out/index.js
+++ package/out/index.js
@@ -1,7 +1,7 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNativeUiBuildConfig = exports.handleWebpackCompilationResult = exports.getCompiler = exports.BundlerError = exports.NODE_RUNTIME_CODE_FILE = exports.getNodeBundler = exports.NativeUIBundler = exports.runLinter = exports.getEntryPoints = exports.getOutputDir = void 0;
+exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNativeUiBuildConfig = exports.handleWebpackCompilationResult = exports.getCompiler = exports.mergeMetadata = exports.emptyMetadata = exports.BundlerError = exports.NODE_RUNTIME_CODE_FILE = exports.getNodeBundler = exports.NativeUIBundler = exports.runLinter = exports.getEntryPoints = exports.getOutputDir = void 0;
 var common_1 = require("./common");
 Object.defineProperty(exports, "getOutputDir", { enumerable: true, get: function () { return common_1.getOutputDir; } });
 Object.defineProperty(exports, "getEntryPoints", { enumerable: true, get: function () { return common_1.getEntryPoints; } });
 var lint_1 = require("./lint");
@@ -12,8 +12,10 @@
 Object.defineProperty(exports, "getNodeBundler", { enumerable: true, get: function () { return runtime_1.getNodeBundler; } });
 Object.defineProperty(exports, "NODE_RUNTIME_CODE_FILE", { enumerable: true, get: function () { return runtime_1.NODE_RUNTIME_CODE_FILE; } });
 var types_1 = require("./types");
 Object.defineProperty(exports, "BundlerError", { enumerable: true, get: function () { return types_1.BundlerError; } });
+Object.defineProperty(exports, "emptyMetadata", { enumerable: true, get: function () { return types_1.emptyMetadata; } });
+Object.defineProperty(exports, "mergeMetadata", { enumerable: true, get: function () { return types_1.mergeMetadata; } });
 var webpack_1 = require("./webpack");
 Object.defineProperty(exports, "getCompiler", { enumerable: true, get: function () { return webpack_1.getCompiler; } });
 Object.defineProperty(exports, "handleWebpackCompilationResult", { enumerable: true, get: function () { return webpack_1.handleWebpackCompilationResult; } });
 var nativeui_2 = require("./config/nativeui");

Modified: package/out/nativeui.js

Index: package/out/nativeui.js
===================================================================
--- package/out/nativeui.js
+++ package/out/nativeui.js
@@ -9,8 +9,9 @@
         return (0, nativeui_1.getNativeUiBuildConfig)(entryPoints, i18nConfig);
     }
     async bundleResources(resources, i18nConfig) {
         const nativeUiBundlesDetails = [];
+        let combinedMetadata = (0, types_1.emptyMetadata)();
         await Promise.all(resources.map(async (resource) => {
             const entryPoint = {
                 name: resource.key,
                 path: resource.path
@@ -25,17 +26,21 @@
             }
             catch (e) {
                 throw new types_1.BundlerError(e.message);
             }
-            const { outputDir } = bundlerOutput;
+            const { outputDir, metadata } = bundlerOutput;
             this.logger.debug(`NativeUI bundle created: ${outputDir}`);
             nativeUiBundlesDetails.push({
                 ...resource,
                 path: outputDir
             });
+            if (metadata) {
+                combinedMetadata = (0, types_1.mergeMetadata)(combinedMetadata, metadata);
+            }
         }));
         return {
-            nativeUiBundlesDetails
+            nativeUiBundlesDetails,
+            metadata: combinedMetadata
         };
     }
 }
 exports.NativeUIBundler = NativeUIBundler;

Modified: package/out/runtime.js

Index: package/out/runtime.js
===================================================================
--- package/out/runtime.js
+++ package/out/runtime.js
@@ -79,10 +79,10 @@
     constructor(logger, wrapperProvider) {
         super(logger);
         this.wrapperProvider = wrapperProvider;
     }
-    async getResult(args, outputDir) {
-        const result = await super.getResult(args, outputDir);
+    async getResult(args, outputDir, output) {
+        const result = await super.getResult(args, outputDir, output);
         const emit = async (name, contents) => {
             const outputPath = path_1.default.join(outputDir, name);
             await promises_1.default.mkdir(path_1.default.dirname(outputPath), { recursive: true });
             await promises_1.default.writeFile(outputPath, contents);

Modified: package/out/text.js

Index: package/out/text.js
===================================================================
--- package/out/text.js
+++ package/out/text.js
@@ -2,8 +2,8 @@
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.Text = void 0;
 exports.Text = {
     genericBundlingError: (errors) => `Bundling failed: ${errors.join(', ')}`,
-    typescriptError: (errors) => `TypeScript errors in the app caused the bundling to fail. Fix the errors listed below before rerunning the command. ${errors.join('')}`,
+    typescriptError: (errors) => `TypeScript errors in the app caused the bundling to fail. Fix the errors listed below before rerunning the command. ${errors.join('\n')}`,
     noExecutableFile: 'Could not find the main executable file',
-    unsupported: (requestedModule) => `⚠️  the '${requestedModule}' module is not supported by Forge, please refer to the documentation at https://go.atlassian.com/forge-runtime-js-environment`
+    metadataFailed: (error) => `Application code metadata processing failed: ${error.message}`
 };

Modified: package/out/types.js

Index: package/out/types.js
===================================================================
--- package/out/types.js
+++ package/out/types.js
@@ -1,7 +1,30 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.BundlerError = void 0;
+exports.BundlerError = exports.mergeMetadata = exports.emptyMetadata = void 0;
 const cli_shared_1 = require("@forge/cli-shared");
+function emptyMetadata() {
+    return {
+        jsFiles: 0,
+        tsFiles: 0,
+        esm: false,
+        dependencies: new Set(),
+        sdkImports: new Set()
+    };
+}
+exports.emptyMetadata = emptyMetadata;
+function mergeMetadata(metadata1, metadata2) {
+    return {
+        ...((metadata1.modules || metadata2.modules) && {
+            modules: [...(metadata1.modules ?? []), ...(metadata2.modules ?? [])]
+        }),
+        jsFiles: metadata1.jsFiles + metadata2.jsFiles,
+        tsFiles: metadata1.tsFiles + metadata2.tsFiles,
+        esm: metadata1.esm || metadata2.esm,
+        dependencies: new Set([...metadata1.dependencies, ...metadata2.dependencies]),
+        sdkImports: new Set([...metadata1.sdkImports, ...metadata2.sdkImports])
+    };
+}
+exports.mergeMetadata = mergeMetadata;
 class BundlerError extends cli_shared_1.UserError {
 }
 exports.BundlerError = BundlerError;

Modified: package/out/typescript.js

Index: package/out/typescript.js
===================================================================
--- package/out/typescript.js
+++ package/out/typescript.js
@@ -9,8 +9,10 @@
 const cli_shared_1 = require("@forge/cli-shared");
 const common_1 = require("./common");
 const dependencies_1 = require("./dependencies");
 const text_1 = require("./text");
+const types_1 = require("./types");
+const metadata_1 = require("./metadata");
 const COPY_DEPENDENCIES_OPTIONS = {
     exclude: ['@forge/react', '@forge/bridge']
 };
 class TypeScriptBundler {
@@ -24,31 +26,68 @@
         processArgs.push('--rootDir', path_1.default.join(args.appDirectory, common_1.SOURCE_DIR));
         if (args.watchMode) {
             processArgs.push('--watch');
         }
+        else {
+            processArgs.push('--listFiles');
+        }
         processArgs.push('--outDir', outputDir);
         let tsc = 'tsc';
         const appTsc = path_1.default.join(args.appDirectory, common_1.NODE_MODULES_DIR, '.bin', 'tsc');
         if ((0, fs_1.existsSync)(appTsc)) {
             tsc = appTsc;
         }
         return (0, cross_spawn_1.default)(tsc, processArgs, { stdio: ['ignore', 'pipe', 'inherit'] });
     }
-    async getResult(args, outputDir) {
-        return { outputDir, metadata: {} };
+    isListedFile(line) {
+        line = line.trim();
+        if (line.length === 0) {
+            return null;
+        }
+        if (!line.match(/^\/.+\.[cm]?[jt]sx?$/)) {
+            return null;
+        }
+        return line;
     }
+    isAppFile(line) {
+        if (!this.isListedFile(line)) {
+            return null;
+        }
+        if (line.includes('node_modules/')) {
+            return null;
+        }
+        return line;
+    }
+    async getResult(args, outputDir, output) {
+        let metadata;
+        if (output) {
+            const files = [];
+            for (const line of output.split('\n')) {
+                const filePath = this.isAppFile(line);
+                if (filePath) {
+                    files.push(filePath);
+                }
+            }
+            metadata = await (0, metadata_1.getMetadata)(this.logger, files);
+        }
+        else {
+            metadata = (0, types_1.emptyMetadata)();
+        }
+        return { outputDir, metadata };
+    }
     async bundle(args) {
         const outputDir = (0, common_1.getOutputDir)(args);
         await (0, dependencies_1.copyProductionDependencies)(args.appDirectory, outputDir, COPY_DEPENDENCIES_OPTIONS);
         const compiler = this.runTypeScript(args, outputDir);
-        const output = [];
-        compiler.stdout.on('data', (data) => output.push(data));
+        let output = '';
+        compiler.stdout.on('data', (data) => (output += data.toString()));
         return new Promise((resolve, reject) => compiler.on('exit', async (code) => {
             try {
                 if (code !== 0) {
-                    throw new cli_shared_1.BundlerTSError(text_1.Text.typescriptError(output));
+                    const errors = output.split('\n').filter((line) => !this.isListedFile(line));
+                    throw new cli_shared_1.BundlerTSError(text_1.Text.typescriptError(errors));
                 }
-                const result = await this.getResult(args, outputDir);
+                const result = await this.getResult(args, outputDir, output);
                 resolve(result);
             }
             catch (e) {
                 reject(e);

Modified: package/out/webpack.js

Index: package/out/webpack.js
===================================================================
--- package/out/webpack.js
+++ package/out/webpack.js
@@ -1,10 +1,12 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.WebpackBundler = exports.getCompiler = exports.handleWebpackCompilationResult = void 0;
 const tslib_1 = require("tslib");
+const path_1 = tslib_1.__importDefault(require("path"));
 const webpack_1 = tslib_1.__importDefault(require("webpack"));
 const cli_shared_1 = require("@forge/cli-shared");
+const metadata_1 = require("./metadata");
 const text_1 = require("./text");
 function handleWebpackCompilationResult(logger, err, stats) {
     if (err) {
         throw err;
@@ -61,14 +63,53 @@
         this.logger = logger;
     }
     async getOutput(config, stats) {
         const outputDir = config.output.path;
-        const metadata = {};
+        const metadata = await (0, metadata_1.getMetadata)(this.logger, this.localModules(stats));
         if (stats) {
             metadata.modules = getNodeModuleNames(stats);
         }
         return { outputDir, metadata };
     }
+    isLocalModule(name) {
+        if (name.match(/\/node_modules\/(.+)$/)) {
+            return false;
+        }
+        if (name.match(/^external "(?:node:)?([^:"]+)"$/)) {
+            return false;
+        }
+        if (name.startsWith('webpack/runtime/')) {
+            return false;
+        }
+        if (path_1.default.extname(name) === '.json') {
+            return false;
+        }
+        if (!path_1.default.extname(name).match(/^\.[cm]?[jt]sx?$/)) {
+            throw new Error(`Unknown module type for ${JSON.stringify(name)}.`);
+        }
+        return true;
+    }
+    localModules(stats) {
+        const { modules } = stats.toJson({ modules: true });
+        const result = [];
+        const addModules = (modules) => {
+            for (const module of modules) {
+                if (module.modules) {
+                    addModules(module.modules);
+                }
+                else if (!module.name) {
+                    throw new Error('Module name is missing');
+                }
+                else if (this.isLocalModule(module.name)) {
+                    result.push(module.name);
+                }
+            }
+        };
+        if (modules) {
+            addModules(modules);
+        }
+        return result;
+    }
     async runCompiler(config) {
         const compiler = getCompiler(config);
         return new Promise((resolve, reject) => {
             compiler.run(async (compilerError, stats) => {

Modified: package/package.json

Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "@forge/bundler",
-  "version": "6.1.4-next.0",
+  "version": "6.1.4-next.1",
   "description": "Default bundler for Forge apps",
   "license": "SEE LICENSE IN LICENSE.txt",
   "author": "Atlassian",
   "main": "out/index.js",
@@ -12,16 +12,18 @@
     "clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
   },
   "dependencies": {
     "@babel/core": "^7.24.0",
+    "@babel/parser": "7.28.0",
     "@babel/plugin-transform-class-properties": "^7.23.3",
     "@babel/plugin-transform-class-static-block": "^7.23.4",
     "@babel/plugin-transform-numeric-separator": "^7.23.4",
     "@babel/plugin-transform-optional-chaining": "^7.23.4",
     "@babel/plugin-transform-react-jsx": "^7.23.4",
-    "@forge/cli-shared": "8.5.0-next.0",
+    "@babel/traverse": "^7.24.0",
+    "@forge/cli-shared": "8.5.0-next.1",
     "@forge/i18n": "0.0.7",
-    "@forge/lint": "5.10.3-next.0",
+    "@forge/lint": "5.10.3-next.1",
     "@forge/manifest": "10.3.0",
     "babel-loader": "^8.3.0",
     "cheerio": "^1.1.0",
     "cross-spawn": "^7.0.6",
@@ -30,8 +32,9 @@
     "nock": "13.5.6",
     "node-fetch": "2.7.0",
     "tmp": "^0.2.3",
     "ts-loader": "^9.5.2",
+    "type-fest": "4.10.2",
     "typescript": "4.8.4",
     "webpack": "^5.99.9",
     "webpack-bundle-analyzer": "^4.10.2"
   },

Modified: package/out/index.d.ts.map

Index: package/out/index.d.ts.map
===================================================================
--- package/out/index.d.ts.map
+++ package/out/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
\ No newline at end of file

Modified: package/out/nativeui.d.ts.map

Index: package/out/nativeui.d.ts.map
===================================================================
--- package/out/nativeui.d.ts.map
+++ package/out/nativeui.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../src/nativeui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAA+B,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;CAC3C;AAED,qBAAa,eAAgB,SAAQ,cAAc;IAC3C,SAAS,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIvE,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,UAAU,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAmCrH"}
\ No newline at end of file
+{"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../src/nativeui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAgB,eAAe,EAA+C,MAAM,SAAS,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;IAC1C,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,qBAAa,eAAgB,SAAQ,cAAc;IAC3C,SAAS,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIvE,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,UAAU,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAyCrH"}
\ No newline at end of file

Modified: package/out/text.d.ts.map

Index: package/out/text.d.ts.map
===================================================================
--- package/out/text.d.ts.map
+++ package/out/text.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;mCACgB,MAAM,EAAE;8BACb,MAAM,EAAE;;mCAKH,MAAM;CAEtC,CAAC"}
\ No newline at end of file
+{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;mCACgB,MAAM,EAAE;8BACb,MAAM,EAAE;;4BAKV,KAAK;CAC9B,CAAC"}
\ No newline at end of file

Modified: package/out/types.d.ts.map

Index: package/out/types.d.ts.map
===================================================================
--- package/out/types.d.ts.map
+++ package/out/types.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,oBAAY,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,oBAAY,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEvF,oBAAY,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjD,oBAAY,UAAU,GAAG;IACvB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gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,eAAe,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAC1G,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;CACd;AAED,oBAAY,kBAAkB,GAAG,cAAc,GAAG;IAChD,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAClD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACjF,CAAC;AAEF,qBAAa,YAAa,SAAQ,SAAS;CAAG"}
\ No newline at end of file

Modified: package/out/typescript.d.ts.map

Index: package/out/typescript.d.ts.map
===================================================================
--- package/out/typescript.d.ts.map
+++ package/out/typescript.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../src/typescript.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AASlC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,aAAK,aAAa,GAAG,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AA6B/D,8BAAsB,iBAAkB,YAAW,OAAO;IAC5C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;gBA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iBlG,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IA6BjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2DtF"}
\ No newline at end of file

Modified: package/out/webpack.d.ts.map

Index: package/out/webpack.d.ts.map
===================================================================
--- package/out/webpack.d.ts.map
+++ package/out/webpack.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EACL,OAAO,EACP,YAAY,EAEZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC,GAAG,SAAS,GAC7E,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAkChC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAE3E;AAqBD,oBAAY,gBAAgB,GAAG,OAAO,CAAC,aAAa,GAAG;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAEvF,8BAAsB,cAAe,YAAW,OAAO;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;cAEnC,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,C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E,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBjG,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAyB9C,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,EAAE;cA0BtC,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsB7E,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAKjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsCtF"}
\ No newline at end of file

Modified: package/CHANGELOG.md

Large diffs are not rendered by default.

Modified: package/out/index.d.ts

Index: package/out/index.d.ts
===================================================================
--- package/out/index.d.ts
+++ package/out/index.d.ts
@@ -1,9 +1,9 @@
 export { getOutputDir, getEntryPoints } from './common';
 export { runLinter } from './lint';
 export { NativeUIBundler, NativeUIBundleResult } from './nativeui';
 export { getNodeBundler, NODE_RUNTIME_CODE_FILE } from './runtime';
-export { Bundler, BundlerError, BundlerOutput, BundlerWatch, EntryPoint, WatcherMonitor } from './types';
+export { Bundler, BundlerError, BundlerMetadata, emptyMetadata, mergeMetadata, BundlerOutput, BundlerWatch, EntryPoint, WatcherMonitor } from './types';
 export { getCompiler, handleWebpackCompilationResult } from './webpack';
 export { getNativeUiBuildConfig } from './config/nativeui';
 export { getWrapperProvider, LocalWrapperProvider } from './wrapper-provider';
 //# sourceMappingURL=index.d.ts.map
\ No newline at end of file

Modified: package/out/nativeui.d.ts

Index: package/out/nativeui.d.ts
===================================================================
--- package/out/nativeui.d.ts
+++ package/out/nativeui.d.ts
@@ -1,10 +1,11 @@
 import { ResourceDetails } from '@forge/cli-shared';
 import { Translations } from '@forge/manifest';
-import { BundlerArgs } from './types';
+import { BundlerArgs, BundlerMetadata } from './types';
 import { ConfigWithOutput, WebpackBundler } from './webpack';
 export interface NativeUIBundleResult {
     nativeUiBundlesDetails: ResourceDetails[];
+    metadata: BundlerMetadata;
 }
 export declare class NativeUIBundler extends WebpackBundler {
     getConfig({ entryPoints, i18nConfig }: BundlerArgs): Promise<ConfigWithOutput>;
     bundleResources(resources: ResourceDetails[], i18nConfig?: Translations): Promise<NativeUIBundleResult>;

Modified: package/out/text.d.ts

Index: package/out/text.d.ts
===================================================================
--- package/out/text.d.ts
+++ package/out/text.d.ts
@@ -1,7 +1,7 @@
 export declare const Text: {
     genericBundlingError: (errors: string[]) => string;
     typescriptError: (errors: string[]) => string;
     noExecutableFile: string;
-    unsupported: (requestedModule: string) => string;
+    metadataFailed: (error: Error) => string;
 };
 //# sourceMappingURL=text.d.ts.map
\ No newline at end of file

Modified: package/out/types.d.ts

Index: package/out/types.d.ts
===================================================================
--- package/out/types.d.ts
+++ package/out/types.d.ts
@@ -1,9 +1,16 @@
 import { I18nResourceBundle, Logger, UserError } from '@forge/cli-shared';
 import { Translations } from '@forge/manifest';
 export declare type BundlerMetadata = {
     modules?: string[];
+    jsFiles: number;
+    tsFiles: number;
+    esm: boolean;
+    dependencies: Set<string>;
+    sdkImports: Set<string>;
 };
+export declare function emptyMetadata(): BundlerMetadata;
+export declare function mergeMetadata(metadata1: BundlerMetadata, metadata2: BundlerMetadata): BundlerMetadata;
 export interface BundlerOutput {
     outputDir: string;
     metadata?: BundlerMetadata;
 }

Modified: package/out/typescript.d.ts

Index: package/out/typescript.d.ts
===================================================================
--- package/out/typescript.d.ts
+++ package/out/typescript.d.ts
@@ -7,9 +7,11 @@
 export declare abstract class TypeScriptBundler implements Bundler {
     protected readonly logger: BundleLogger;
     constructor(logger: BundleLogger);
     protected runTypeScript(args: BundlerArgs, outputDir: string): OutputProcess;
-    protected getResult(args: BundlerArgs, outputDir: string): Promise<BundlerOutput>;
+    protected isListedFile(line: string): string | null;
+    protected isAppFile(line: string): string | null;
+    protected getResult(args: BundlerArgs, outputDir: string, output?: string): Promise<BundlerOutput>;
     bundle(args: BundlerArgs): Promise<BundlerOutput>;
     watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;
 }
 export {};

Modified: package/out/webpack.d.ts

Index: package/out/webpack.d.ts
===================================================================
--- package/out/webpack.d.ts
+++ package/out/webpack.d.ts
@@ -9,8 +9,10 @@
 export declare abstract class WebpackBundler implements Bundler {
     protected readonly logger: BundleLogger;
     constructor(logger: BundleLogger);
     protected getOutput(config: ConfigWithOutput, stats: webpack.Stats): Promise<BundlerOutput>;
+    protected isLocalModule(name: string): boolean;
+    protected localModules(stats: webpack.Stats): string[];
     protected runCompiler(config: ConfigWithOutput): Promise<BundlerOutput>;
     abstract getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
     bundle(args: BundlerArgs): Promise<BundlerOutput>;
     watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;