@forge/bundler 4.0.3-next.1 → 4.1.0-next.2
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.
- package/CHANGELOG.md +12 -0
- package/out/bundler-config/nativeui-webpack-config.d.ts +2 -2
- package/out/bundler-config/nativeui-webpack-config.d.ts.map +1 -1
- package/out/bundler-config/nativeui-webpack-config.js +5 -3
- package/out/bundler-config/sandboxed-webpack-config.d.ts +1 -0
- package/out/bundler-config/sandboxed-webpack-config.d.ts.map +1 -1
- package/out/bundler-config/sandboxed-webpack-config.js +3 -1
- package/out/index.d.ts +3 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +9 -1
- package/out/types.d.ts +1 -1
- package/out/types.d.ts.map +1 -1
- package/out/webpack.d.ts +14 -2
- package/out/webpack.d.ts.map +1 -1
- package/out/webpack.js +30 -11
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 4.1.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e37918e4: Implement support for client-side UI Kit tunneling
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [e37918e4]
|
|
12
|
+
- @forge/cli-shared@3.4.0-next.1
|
|
13
|
+
- @forge/lint@3.2.11-next.1
|
|
14
|
+
|
|
3
15
|
## 4.0.3-next.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Configuration as WebpackConfig } from 'webpack';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getNativeUiBuildConfig: (entrypoints: EntryPoints
|
|
2
|
+
import { EntryPoints } from '../webpack';
|
|
3
|
+
export declare const getNativeUiBuildConfig: (entrypoints: EntryPoints) => WebpackConfig;
|
|
4
4
|
//# sourceMappingURL=nativeui-webpack-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeui-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/nativeui-webpack-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"nativeui-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/nativeui-webpack-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,eAAO,MAAM,sBAAsB,gCAA+B,aAwEjE,CAAC"}
|
|
@@ -6,18 +6,20 @@ const path_1 = require("path");
|
|
|
6
6
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
7
7
|
const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
|
|
8
8
|
const tmp_1 = tslib_1.__importDefault(require("tmp"));
|
|
9
|
-
const getNativeUiBuildConfig = (entrypoints
|
|
9
|
+
const getNativeUiBuildConfig = (entrypoints) => {
|
|
10
10
|
const resolvedEntryPoints = {};
|
|
11
11
|
for (const entrypoint of entrypoints) {
|
|
12
12
|
resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
|
|
13
13
|
}
|
|
14
14
|
return {
|
|
15
15
|
entry: Object.assign({}, resolvedEntryPoints),
|
|
16
|
+
name: 'native-ui',
|
|
16
17
|
mode: 'production',
|
|
17
18
|
devtool: 'source-map',
|
|
18
19
|
output: {
|
|
19
20
|
filename: '[name].js',
|
|
20
|
-
path: tmp_1.default.dirSync().name
|
|
21
|
+
path: tmp_1.default.dirSync().name,
|
|
22
|
+
publicPath: 'auto'
|
|
21
23
|
},
|
|
22
24
|
node: {
|
|
23
25
|
__dirname: true
|
|
@@ -26,7 +28,7 @@ const getNativeUiBuildConfig = (entrypoints, config) => {
|
|
|
26
28
|
new html_webpack_plugin_1.default({
|
|
27
29
|
filename: 'index.html'
|
|
28
30
|
}),
|
|
29
|
-
new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true })
|
|
31
|
+
new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true, logLevel: 'silent' })
|
|
30
32
|
],
|
|
31
33
|
resolve: {
|
|
32
34
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.jpg', '.jpeg', '.png', '.gif', '.svg']
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Configuration as WebpackConfig } from 'webpack';
|
|
2
2
|
import { ConfigBuilder, EntryPoints } from '../webpack';
|
|
3
|
+
export declare const SANDBOXED_WEBPACK_CONFIG_NAME = "sandboxed-runtime";
|
|
3
4
|
export declare const getSandboxedRuntimeBuildConfig: (entrypoints: EntryPoints, config: ConfigBuilder) => WebpackConfig;
|
|
4
5
|
//# sourceMappingURL=sandboxed-webpack-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxed-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/sandboxed-webpack-config.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,WAAW,EAA6C,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"sandboxed-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/sandboxed-webpack-config.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,WAAW,EAA6C,MAAM,YAAY,CAAC;AAEnG,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAyDjE,eAAO,MAAM,8BAA8B,qCAAsC,aAAa,KAAG,aAwEhG,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSandboxedRuntimeBuildConfig = void 0;
|
|
3
|
+
exports.getSandboxedRuntimeBuildConfig = exports.SANDBOXED_WEBPACK_CONFIG_NAME = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
7
7
|
const stub_plugin_1 = require("../stub-plugin");
|
|
8
8
|
const webpack_2 = require("../webpack");
|
|
9
|
+
exports.SANDBOXED_WEBPACK_CONFIG_NAME = 'sandboxed-runtime';
|
|
9
10
|
const getCustomModulesAliases = () => {
|
|
10
11
|
return {
|
|
11
12
|
'browserify-cipher': (0, webpack_2.resolveModulePath)('browserify-cipher/browser.js'),
|
|
@@ -100,6 +101,7 @@ const getSandboxedRuntimeBuildConfig = (entrypoints, config) => {
|
|
|
100
101
|
moduleRuls.forEach((rule) => webpackConfig.module.rules.push(rule));
|
|
101
102
|
webpackConfig.target = 'webworker';
|
|
102
103
|
webpackConfig.resolve = Object.assign(Object.assign({}, webpackConfig.resolve), { mainFields: ['main', 'module'], exportsFields: [], alias: getCustomModulesAliases() });
|
|
104
|
+
webpackConfig.name = exports.SANDBOXED_WEBPACK_CONFIG_NAME;
|
|
103
105
|
return webpackConfig;
|
|
104
106
|
};
|
|
105
107
|
exports.getSandboxedRuntimeBuildConfig = getSandboxedRuntimeBuildConfig;
|
package/out/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { Bundler, InDiskBundler, Watcher, WatcherMonitor, BundlerOutput } from './types';
|
|
2
|
-
export { sandboxBundle, nodeBundle, nativeUiBundle, watch } from './webpack';
|
|
2
|
+
export { sandboxBundle, nodeBundle, nativeUiBundle, watch, getCompiler, getInMemoryBundle, handleWebpackCompilationResult, runLinter } from './webpack';
|
|
3
|
+
export { getNativeUiBuildConfig } from './bundler-config/nativeui-webpack-config';
|
|
4
|
+
export { getSandboxedRuntimeBuildConfig } from './bundler-config/sandboxed-webpack-config';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,8BAA8B,EAC9B,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.watch = exports.nativeUiBundle = exports.nodeBundle = exports.sandboxBundle = void 0;
|
|
3
|
+
exports.getSandboxedRuntimeBuildConfig = exports.getNativeUiBuildConfig = exports.runLinter = exports.handleWebpackCompilationResult = exports.getInMemoryBundle = exports.getCompiler = exports.watch = exports.nativeUiBundle = exports.nodeBundle = exports.sandboxBundle = void 0;
|
|
4
4
|
var webpack_1 = require("./webpack");
|
|
5
5
|
Object.defineProperty(exports, "sandboxBundle", { enumerable: true, get: function () { return webpack_1.sandboxBundle; } });
|
|
6
6
|
Object.defineProperty(exports, "nodeBundle", { enumerable: true, get: function () { return webpack_1.nodeBundle; } });
|
|
7
7
|
Object.defineProperty(exports, "nativeUiBundle", { enumerable: true, get: function () { return webpack_1.nativeUiBundle; } });
|
|
8
8
|
Object.defineProperty(exports, "watch", { enumerable: true, get: function () { return webpack_1.watch; } });
|
|
9
|
+
Object.defineProperty(exports, "getCompiler", { enumerable: true, get: function () { return webpack_1.getCompiler; } });
|
|
10
|
+
Object.defineProperty(exports, "getInMemoryBundle", { enumerable: true, get: function () { return webpack_1.getInMemoryBundle; } });
|
|
11
|
+
Object.defineProperty(exports, "handleWebpackCompilationResult", { enumerable: true, get: function () { return webpack_1.handleWebpackCompilationResult; } });
|
|
12
|
+
Object.defineProperty(exports, "runLinter", { enumerable: true, get: function () { return webpack_1.runLinter; } });
|
|
13
|
+
var nativeui_webpack_config_1 = require("./bundler-config/nativeui-webpack-config");
|
|
14
|
+
Object.defineProperty(exports, "getNativeUiBuildConfig", { enumerable: true, get: function () { return nativeui_webpack_config_1.getNativeUiBuildConfig; } });
|
|
15
|
+
var sandboxed_webpack_config_1 = require("./bundler-config/sandboxed-webpack-config");
|
|
16
|
+
Object.defineProperty(exports, "getSandboxedRuntimeBuildConfig", { enumerable: true, get: function () { return sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig; } });
|
package/out/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface BundlerOutput {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export declare type Bundler = (appDirectory: string, endpointPath: EntryPoints) => Promise<BundlerOutput>;
|
|
17
|
-
export declare type InDiskBundler = (
|
|
17
|
+
export declare type InDiskBundler = (entrypoints: EntryPoints) => Promise<{
|
|
18
18
|
outputDir: string;
|
|
19
19
|
}>;
|
|
20
20
|
export declare type WatcherCallback = (err: Error | null, output?: BundlerOutput) => void;
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,oBAAY,YAAY,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAC1D,oBAAY,gBAAgB,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,oBAAY,OAAO,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAClG,oBAAY,aAAa,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,oBAAY,YAAY,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAC1D,oBAAY,gBAAgB,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,oBAAY,OAAO,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAClG,oBAAY,aAAa,GAAG,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEzF,oBAAY,eAAe,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;AAClF,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;CACd;AAED,oBAAY,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEpE,oBAAY,OAAO,GAAG,CACpB,YAAY,EAAE,WAAW,EACzB,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,QAAQ,KAChB,cAAc,CAAC"}
|
package/out/webpack.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { Configuration as WebpackConfig, ModuleOptions } from 'webpack';
|
|
2
|
-
import { Bundler, Watcher, InDiskBundler } from './types';
|
|
1
|
+
import webpack, { Compiler, Configuration as WebpackConfig, ModuleOptions } from 'webpack';
|
|
2
|
+
import { Bundler, Watcher, InDiskBundler, BundlerOutput } from './types';
|
|
3
|
+
import { FileSystemReader, FileSystemWriter } from '@forge/cli-shared';
|
|
4
|
+
import { LintLogger } from '@forge/lint';
|
|
3
5
|
export declare type EntryPoints = Array<{
|
|
4
6
|
name: string;
|
|
5
7
|
path: string;
|
|
6
8
|
}>;
|
|
7
9
|
export declare const resolveModulePath: (moduleName: string) => string;
|
|
10
|
+
export declare const handleWebpackCompilationResult: (err: Error | undefined, stats: webpack.Stats | undefined) => stats is webpack.Stats;
|
|
11
|
+
export declare const getInMemoryBundle: (entryPoints: {
|
|
12
|
+
name: string;
|
|
13
|
+
path: string;
|
|
14
|
+
}[]) => BundlerOutput;
|
|
8
15
|
export declare const getDevToolConfig: (config: ConfigBuilder) => string;
|
|
9
16
|
declare type RequiredFields<T, F extends keyof T> = T & Required<Pick<T, F>>;
|
|
10
17
|
declare type CommonModuleOptions = RequiredFields<ModuleOptions, 'rules'>;
|
|
@@ -15,6 +22,11 @@ export interface ConfigBuilder {
|
|
|
15
22
|
isDebugMode?: boolean;
|
|
16
23
|
appDirectory: string;
|
|
17
24
|
}
|
|
25
|
+
interface CompilerOptions {
|
|
26
|
+
writeToDisk?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const getCompiler: (webpackConfig: WebpackConfig, options?: CompilerOptions) => Compiler;
|
|
29
|
+
export declare const runLinter: (logger?: LintLogger, fileSystemReader?: FileSystemReader, fileSystemWriter?: FileSystemWriter) => Promise<void>;
|
|
18
30
|
export declare const watch: Watcher;
|
|
19
31
|
export declare const createBundler: (getBuildConfig: (entrypoints: EntryPoints, configBuilder: ConfigBuilder) => WebpackConfig) => Bundler;
|
|
20
32
|
export declare const sandboxBundle: Bundler;
|
package/out/webpack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3F,OAAO,EACL,OAAO,EAGP,OAAO,EAEP,aAAa,EACb,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAOlE,oBAAY,WAAW,GAAG,KAAK,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAQH,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,eAAO,MAAM,8BAA8B,QACpC,KAAK,GAAG,SAAS,SACf,QAAQ,KAAK,GAAG,SAAS,2BAmCjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,gBAAiB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAG,aAiBjF,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AACF,aAAK,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrE,aAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClE,aAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACvH,eAAO,MAAM,sBAAsB,qCAAsC,aAAa,KAAG,mBA8FxF,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,eAAe;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,WAAW,kBAAmB,aAAa,YAAY,eAAe,KAAG,QAOrF,CAAC;AA6BF,eAAO,MAAM,SAAS,YAEZ,UAAU,+EAGjB,QAAQ,IAAI,CAuBd,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,OAwCnB,CAAC;AAEF,eAAO,MAAM,aAAa,6DACkC,aAAa,KAAK,aAAa,KACxF,OAyCF,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAuD,CAAC;AAEpF,eAAO,MAAM,UAAU,EAAE,OAuBxB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAoB5B,CAAC"}
|
package/out/webpack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nativeUiBundle = exports.nodeBundle = exports.sandboxBundle = exports.createBundler = exports.watch = exports.getCommonWebpackConfig = exports.getDevToolConfig = exports.resolveModulePath = void 0;
|
|
3
|
+
exports.nativeUiBundle = exports.nodeBundle = exports.sandboxBundle = exports.createBundler = exports.watch = exports.runLinter = exports.getCompiler = exports.getCommonWebpackConfig = exports.getDevToolConfig = exports.getInMemoryBundle = exports.handleWebpackCompilationResult = exports.resolveModulePath = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
6
|
const memfs_1 = require("memfs");
|
|
@@ -22,7 +22,7 @@ const resolveModulePath = (moduleName) => {
|
|
|
22
22
|
return require.resolve(moduleName);
|
|
23
23
|
};
|
|
24
24
|
exports.resolveModulePath = resolveModulePath;
|
|
25
|
-
const
|
|
25
|
+
const handleWebpackCompilationResult = (err, stats) => {
|
|
26
26
|
if (err) {
|
|
27
27
|
throw err;
|
|
28
28
|
}
|
|
@@ -48,6 +48,23 @@ const handleCallback = (err, stats) => {
|
|
|
48
48
|
}
|
|
49
49
|
return true;
|
|
50
50
|
};
|
|
51
|
+
exports.handleWebpackCompilationResult = handleWebpackCompilationResult;
|
|
52
|
+
const getInMemoryBundle = (entryPoints) => {
|
|
53
|
+
const output = {}, sourceMap = {};
|
|
54
|
+
entryPoints.forEach(({ name }) => {
|
|
55
|
+
output[name] = readMemoryFileSync(`/${name}.js`);
|
|
56
|
+
try {
|
|
57
|
+
sourceMap[name] = readMemoryFileSync(`/${name}.js.map`);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
output,
|
|
64
|
+
sourceMap
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.getInMemoryBundle = getInMemoryBundle;
|
|
51
68
|
const getDevToolConfig = (config) => {
|
|
52
69
|
if (!config.isWatchMode) {
|
|
53
70
|
return 'source-map';
|
|
@@ -152,6 +169,7 @@ const getCompiler = (webpackConfig, options) => {
|
|
|
152
169
|
}
|
|
153
170
|
return compiler;
|
|
154
171
|
};
|
|
172
|
+
exports.getCompiler = getCompiler;
|
|
155
173
|
const getNodeModuleNames = (stats) => {
|
|
156
174
|
const { modules } = stats.toJson({ modules: true });
|
|
157
175
|
if (modules) {
|
|
@@ -202,21 +220,22 @@ const runLinter = async (logger = { info: console.log }, fileSystemReader = new
|
|
|
202
220
|
logger.info(cli_shared_1.Text.tunnel.lintFailed + '\n');
|
|
203
221
|
}
|
|
204
222
|
};
|
|
223
|
+
exports.runLinter = runLinter;
|
|
205
224
|
const watch = (entryPoints, debugMode, callback, watchRun) => {
|
|
206
225
|
const config = (0, sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig)(entryPoints, {
|
|
207
226
|
isWatchMode: true,
|
|
208
227
|
isDebugMode: debugMode,
|
|
209
228
|
appDirectory: process.cwd()
|
|
210
229
|
});
|
|
211
|
-
const compiler = getCompiler(config);
|
|
230
|
+
const compiler = (0, exports.getCompiler)(config);
|
|
212
231
|
if (typeof watchRun === 'function') {
|
|
213
232
|
compiler.hooks.watchRun.tapAsync('watchRun', (watchRunCompiler, watchRunCallback) => {
|
|
214
|
-
watchRun(watchRunCompiler, runLinter, watchRunCallback);
|
|
233
|
+
watchRun(watchRunCompiler, exports.runLinter, watchRunCallback);
|
|
215
234
|
});
|
|
216
235
|
}
|
|
217
236
|
const watcher = compiler.watch({ poll: 1000 }, (compilerError, stats) => {
|
|
218
237
|
try {
|
|
219
|
-
|
|
238
|
+
(0, exports.handleWebpackCompilationResult)(compilerError, stats);
|
|
220
239
|
const output = {}, sourceMap = {};
|
|
221
240
|
entryPoints.forEach(({ name }) => {
|
|
222
241
|
output[name] = readMemoryFileSync(`/${name}.js`);
|
|
@@ -241,11 +260,11 @@ exports.watch = watch;
|
|
|
241
260
|
const createBundler = (getBuildConfig) => {
|
|
242
261
|
return (appDirectory, endpoints) => {
|
|
243
262
|
const config = getBuildConfig(endpoints, { isWatchMode: false, appDirectory });
|
|
244
|
-
const compiler = getCompiler(config);
|
|
263
|
+
const compiler = (0, exports.getCompiler)(config);
|
|
245
264
|
return new Promise((resolve, reject) => {
|
|
246
265
|
compiler.run((compilerError, stats) => {
|
|
247
266
|
try {
|
|
248
|
-
if (!
|
|
267
|
+
if (!(0, exports.handleWebpackCompilationResult)(compilerError, stats)) {
|
|
249
268
|
return;
|
|
250
269
|
}
|
|
251
270
|
const output = {}, sourceMap = {};
|
|
@@ -293,13 +312,13 @@ const nodeBundle = async (appDirectory, entryPoints) => {
|
|
|
293
312
|
return { output, sourceMap, metadata };
|
|
294
313
|
};
|
|
295
314
|
exports.nodeBundle = nodeBundle;
|
|
296
|
-
const nativeUiBundle = (
|
|
297
|
-
const config = (0, nativeui_webpack_config_1.getNativeUiBuildConfig)(entrypoints
|
|
298
|
-
const compiler = getCompiler(config, { writeToDisk: true });
|
|
315
|
+
const nativeUiBundle = (entrypoints) => {
|
|
316
|
+
const config = (0, nativeui_webpack_config_1.getNativeUiBuildConfig)(entrypoints);
|
|
317
|
+
const compiler = (0, exports.getCompiler)(config, { writeToDisk: true });
|
|
299
318
|
return new Promise((resolve, reject) => {
|
|
300
319
|
compiler.run((compilerError, stats) => {
|
|
301
320
|
try {
|
|
302
|
-
if (!
|
|
321
|
+
if (!(0, exports.handleWebpackCompilationResult)(compilerError, stats)) {
|
|
303
322
|
return;
|
|
304
323
|
}
|
|
305
324
|
resolve({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0-next.2",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@babel/preset-typescript": "^7.16.7",
|
|
21
21
|
"@forge/api": "2.9.0-next.0",
|
|
22
22
|
"@forge/babel-plugin-transform-ui": "1.1.0",
|
|
23
|
-
"@forge/cli-shared": "3.4.0-next.
|
|
24
|
-
"@forge/lint": "3.2.11-next.
|
|
23
|
+
"@forge/cli-shared": "3.4.0-next.1",
|
|
24
|
+
"@forge/lint": "3.2.11-next.1",
|
|
25
25
|
"assert": "^1.1.1",
|
|
26
26
|
"babel-loader": "^8.2.3",
|
|
27
27
|
"browserify-zlib": "^0.2.0",
|