npm package diff

Package: @forge/bundler

Versions: 4.21.1-next.14-experimental-f55f6f2 - 4.22.0-next.16

Added: package/out/dependencies.js

Added: package/out/typescript.js

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

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

Added: package/out/dependencies.d.ts

Added: package/out/typescript.d.ts

Modified: package/out/runtime.js

Index: package/out/runtime.js
===================================================================
--- package/out/runtime.js
+++ package/out/runtime.js
@@ -8,8 +8,9 @@
 var RawSource = webpack_1.default.sources.RawSource;
 const cli_shared_1 = require("@forge/cli-shared");
 const common_1 = require("./config/common");
 const sandbox_1 = require("./config/sandbox");
+const typescript_1 = require("./typescript");
 const webpack_2 = require("./webpack");
 const i18n_1 = require("@forge/i18n");
 class SandboxBundler extends webpack_2.WebpackBundler {
     constructor(logger) {
@@ -90,8 +91,56 @@
         });
         return webpackConfig;
     }
 }
+class TypeScriptNodeBundler extends typescript_1.TypeScriptBundler {
+    wrapperProvider;
+    statsigReader;
+    constructor(logger, wrapperProvider, statsigReader) {
+        super(logger);
+        this.wrapperProvider = wrapperProvider;
+        this.statsigReader = statsigReader;
+    }
+    async getResult(args, outputDir) {
+        if (!(await this.statsigReader.packageSingleWrapper())) {
+            throw new cli_shared_1.UserError('Single wrapper feature flag must be enabled to use the TypeScript bundler.');
+        }
+        const result = await super.getResult(args, outputDir);
+        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);
+        };
+        await emitWrapperFiles(this.wrapperProvider, args.entryPoints, emit, true);
+        if (args.i18nResourceBundle) {
+            await emitI18nFiles(args.i18nResourceBundle, emit);
+        }
+        return result;
+    }
+}
+class ConfigBundler {
+    configReader;
+    bundlers;
+    constructor(logger, wrapperProvider, configReader, statsigReader) {
+        this.configReader = configReader;
+        this.bundlers = new Map([
+            ['webpack', new NodeBundler(logger, wrapperProvider, statsigReader)],
+            ['typescript', new TypeScriptNodeBundler(logger, wrapperProvider, statsigReader)]
+        ]);
+    }
+    async getBundlerType() {
+        return (await this.configReader.readConfig()).app.package?.bundler ?? 'webpack';
+    }
+    async getBundler() {
+        return this.bundlers.get(await this.getBundlerType());
+    }
+    async bundle(args) {
+        return (await this.getBundler()).bundle(args);
+    }
+    async watch(args, watch) {
+        return (await this.getBundler()).watch(args, watch);
+    }
+}
 function getNodeBundler(logger, wrapperProvider, configReader, statsigReader) {
-    return new NodeBundler(logger, wrapperProvider, statsigReader);
+    return new ConfigBundler(logger, wrapperProvider, configReader, statsigReader);
 }
 exports.getNodeBundler = getNodeBundler;

Modified: package/package.json

Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "@forge/bundler",
-  "version": "4.21.1-next.14-experimental-f55f6f2",
+  "version": "4.22.0-next.16",
   "description": "Default bundler for Forge apps",
   "license": "SEE LICENSE IN LICENSE.txt",
   "author": "Atlassian",
   "main": "out/index.js",
@@ -18,24 +18,26 @@
     "@babel/plugin-transform-numeric-separator": "^7.23.4",
     "@babel/plugin-transform-optional-chaining": "^7.23.4",
     "@babel/plugin-transform-react-jsx": "^7.23.4",
     "@babel/preset-typescript": "^7.23.3",
-    "@forge/api": "5.2.0-next.0-experimental-f55f6f2",
+    "@forge/api": "5.2.0-next.0",
     "@forge/babel-plugin-transform-ui": "1.1.21",
-    "@forge/cli-shared": "6.8.0-next.13-experimental-f55f6f2",
-    "@forge/i18n": "0.0.5-next.0-experimental-f55f6f2",
-    "@forge/lint": "5.7.3-next.14-experimental-f55f6f2",
-    "@forge/manifest": "8.9.0-next.7-experimental-f55f6f2",
+    "@forge/cli-shared": "6.8.0-next.15",
+    "@forge/i18n": "0.0.5-next.0",
+    "@forge/lint": "5.7.3-next.16",
+    "@forge/manifest": "8.9.0-next.8",
     "@forge/util": "1.4.8",
     "assert": "^2.1.0",
     "babel-loader": "^8.3.0",
     "browserify-zlib": "^0.2.0",
     "buffer": "^6.0.3",
     "chalk": "^4.1.2",
     "cheerio": "^0.22.0",
     "console-browserify": "^1.2.0",
+    "cross-spawn": "^7.0.5",
     "crypto-browserify": "^3.12.0",
     "events": "^3.3.0",
+    "fs-extra": "^11.2.0",
     "headers-utils": "^3.0.2",
     "html-webpack-plugin": "^5.6.0",
     "inherits": "^2.0.4",
     "memfs": "^4.6.0",
@@ -61,8 +63,10 @@
   },
   "devDependencies": {
     "@atlassian/xen-test-util": "^4.2.0",
     "@forge/runtime": "5.10.7",
+    "@types/cross-spawn": "^6.0.6",
+    "@types/fs-extra": "^11.0.4",
     "@types/jest": "^29.5.12",
     "@types/node": "14.18.63",
     "@types/react": "^18.2.64",
     "@types/readable-stream": "^4.0.10",
@@ -71,8 +75,9 @@
     "@typescript-eslint/parser": "^5.62.0",
     "eslint": "^8.56.0",
     "eslint-config-prettier": "^9.1.0",
     "eslint-plugin-prettier": "^5.1.3",
+    "glob": "^10.3.10",
     "jest-matcher-specific-error": "^1.0.0",
     "prettier": "3.2.5"
   },
   "engines": {

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

Index: package/out/runtime.d.ts.map
===================================================================
--- package/out/runtime.d.ts.map
+++ package/out/runtime.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAqD,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGnH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qBAAa,cAAe,SAAQ,cAAc;gBACpC,MAAM,EAAE,YAAY;IAI1B,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG9D;AAoBD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AA4CD,cAAM,WAAY,SAAQ,cAAc;IAGpC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAF9B,MAAM,EAAE,YAAY,EACH,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa;IAKzC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAoD9D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,GAC3B,WAAW,CAKb"}
\ No newline at end of file
+{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAGZ,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EAMZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qBAAa,cAAe,SAAQ,cAAc;gBACpC,MAAM,EAAE,YAAY;IAI1B,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG9D;AAoBD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AA6KD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAET"}
\ No newline at end of file

Modified: package/CHANGELOG.md

Large diffs are not rendered by default.

Modified: package/out/runtime.d.ts

Index: package/out/runtime.d.ts
===================================================================
--- package/out/runtime.d.ts
+++ package/out/runtime.d.ts
@@ -1,18 +1,11 @@
 import { ConfigReader, StatsigReader } from '@forge/cli-shared';
-import { BundleLogger, BundlerArgs } from './types';
+import { BundleLogger, Bundler, BundlerArgs } from './types';
 import { ConfigWithOutput, WebpackBundler } from './webpack';
 import { WrapperProvider } from './wrapper-provider';
 export declare class SandboxBundler extends WebpackBundler {
     constructor(logger: BundleLogger);
     getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
 }
 export declare function userCodePath(entryKey: string): string;
-declare class NodeBundler extends WebpackBundler {
-    private readonly wrapperProvider;
-    private readonly statsigReader;
-    constructor(logger: BundleLogger, wrapperProvider: WrapperProvider, statsigReader: StatsigReader);
-    getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
-}
-export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader, statsigReader: StatsigReader): NodeBundler;
-export {};
+export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader, statsigReader: StatsigReader): Bundler;
 //# sourceMappingURL=runtime.d.ts.map
\ No newline at end of file