@forge/bundler 4.19.0-next.13 → 4.19.0-next.15
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 +29 -0
- package/out/config/common.d.ts +5 -6
- package/out/config/common.d.ts.map +1 -1
- package/out/config/common.js +9 -17
- package/out/config/nativeui.d.ts +4 -2
- package/out/config/nativeui.d.ts.map +1 -1
- package/out/config/nativeui.js +5 -5
- package/out/config/node.d.ts +2 -2
- package/out/config/node.d.ts.map +1 -1
- package/out/index.d.ts +3 -3
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -3
- package/out/types.d.ts +7 -16
- package/out/types.d.ts.map +1 -1
- package/out/webpack.d.ts +8 -14
- package/out/webpack.d.ts.map +1 -1
- package/out/webpack.js +27 -93
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 4.19.0-next.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d51b7be]
|
|
8
|
+
- @forge/i18n@0.0.1-next.13
|
|
9
|
+
- @forge/cli-shared@5.5.0-next.14
|
|
10
|
+
- @forge/manifest@7.7.0-next.14
|
|
11
|
+
- @forge/lint@5.3.3-next.14
|
|
12
|
+
|
|
13
|
+
## 4.19.0-next.14
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- ac1a61b: Bundle files on disk instead of memory
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [ac1a61b]
|
|
22
|
+
- Updated dependencies [23f6675]
|
|
23
|
+
- Updated dependencies [27249cd]
|
|
24
|
+
- Updated dependencies [0f75e93]
|
|
25
|
+
- Updated dependencies [5f82d22]
|
|
26
|
+
- @forge/cli-shared@5.5.0-next.13
|
|
27
|
+
- @forge/i18n@0.0.1-next.12
|
|
28
|
+
- @forge/manifest@7.7.0-next.13
|
|
29
|
+
- @forge/api@3.9.2-next.2
|
|
30
|
+
- @forge/lint@5.3.3-next.13
|
|
31
|
+
|
|
3
32
|
## 4.19.0-next.13
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/out/config/common.d.ts
CHANGED
|
@@ -6,22 +6,21 @@ export interface ConfigBuilder {
|
|
|
6
6
|
isWatchMode: boolean;
|
|
7
7
|
isDebugMode?: boolean;
|
|
8
8
|
appDirectory: string;
|
|
9
|
+
outputDir: string;
|
|
9
10
|
}
|
|
10
11
|
export declare type EntryPoint = {
|
|
11
12
|
name: string;
|
|
12
13
|
path: string;
|
|
13
14
|
};
|
|
14
|
-
export declare
|
|
15
|
-
functions: string[];
|
|
16
|
-
};
|
|
17
|
-
export declare function getEntryPoints(handlers: Handler[]): FunctionsEntryPoint[];
|
|
15
|
+
export declare function getEntryPoints(handlers: Handler[]): EntryPoint[];
|
|
18
16
|
export declare const resolveModulePath: (moduleName: string) => string;
|
|
19
17
|
export declare function resolveStubPath(stubName: string): string;
|
|
20
18
|
export declare const getDevToolConfig: (config: ConfigBuilder) => string;
|
|
21
|
-
declare type RequiredFields<T, F extends keyof T> = T & Required<Pick<T, F>>;
|
|
19
|
+
export declare type RequiredFields<T, F extends keyof T> = T & Required<Pick<T, F>>;
|
|
20
|
+
export declare type CommonOutputOptions = RequiredFields<Required<WebpackConfig>['output'], 'path'>;
|
|
22
21
|
declare type CommonModuleOptions = RequiredFields<ModuleOptions, 'rules'>;
|
|
23
22
|
export declare type WebpackEntries = Record<string, string>;
|
|
24
|
-
export declare type CommonWebpackConfig = RequiredFields<WebpackConfig, 'module' | 'plugins'
|
|
23
|
+
export declare type CommonWebpackConfig = RequiredFields<WebpackConfig, 'module' | 'plugins'> & Record<'output', CommonOutputOptions> & Record<'module', CommonModuleOptions> & Record<'entry', WebpackEntries>;
|
|
25
24
|
export declare const geti18nRule: (i18nConfig: Translations) => {
|
|
26
25
|
test: RegExp;
|
|
27
26
|
include: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":";AAEA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAOhE;AAED,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AAEF,oBAAY,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5E,oBAAY,mBAAmB,GAAG,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5F,aAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClE,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpD,oBAAY,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAC,GACnF,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAElC,eAAO,MAAM,WAAW,eAAgB,YAAY;;;;;+DAIe;YAAE,QAAQ;gBAAE,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE;;CAalG,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,UAAU,aAAa,KAAG,mBAwGzF,CAAC"}
|
package/out/config/common.js
CHANGED
|
@@ -2,25 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommonWebpackConfig = exports.geti18nRule = exports.getDevToolConfig = exports.resolveStubPath = exports.resolveModulePath = exports.getEntryPoints = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = require("path");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
7
|
-
const text_1 = require("../text");
|
|
8
7
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
9
8
|
const i18n_1 = require("@forge/i18n");
|
|
9
|
+
const text_1 = require("../text");
|
|
10
10
|
const tsconfig_interactor_1 = require("../tsconfig-interactor");
|
|
11
11
|
function getEntryPoints(handlers) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
if (!entryPointMap.has(module)) {
|
|
15
|
-
entryPointMap.set(module, []);
|
|
16
|
-
}
|
|
17
|
-
entryPointMap.get(module).push(func);
|
|
18
|
-
}
|
|
19
|
-
const currentDirectory = process.cwd();
|
|
20
|
-
return Array.from(entryPointMap.entries()).map(([module, functions]) => ({
|
|
12
|
+
const modules = new Set(handlers.map(({ module }) => module));
|
|
13
|
+
return Array.from(modules).map((module) => ({
|
|
21
14
|
name: module,
|
|
22
|
-
path:
|
|
23
|
-
functions
|
|
15
|
+
path: path_1.default.resolve('src', module)
|
|
24
16
|
}));
|
|
25
17
|
}
|
|
26
18
|
exports.getEntryPoints = getEntryPoints;
|
|
@@ -41,10 +33,10 @@ const getDevToolConfig = (config) => {
|
|
|
41
33
|
exports.getDevToolConfig = getDevToolConfig;
|
|
42
34
|
const geti18nRule = (i18nConfig) => {
|
|
43
35
|
const i18nResources = i18nConfig.resources || [];
|
|
44
|
-
const i18nResourcesMap = new Map(i18nResources.map(({ key, path }) => [
|
|
36
|
+
const i18nResourcesMap = new Map(i18nResources.map(({ key, path: resource }) => [path_1.default.resolve(resource), key]));
|
|
45
37
|
const getFilename = ({ module: { resource: i18nResourcePath } }) => {
|
|
46
38
|
const i18nResourceKey = i18nResourcesMap.get(i18nResourcePath);
|
|
47
|
-
return
|
|
39
|
+
return path_1.default.join(i18n_1.I18N_BUNDLE_FOLDER_NAME, `${i18nResourceKey}.json`);
|
|
48
40
|
};
|
|
49
41
|
return {
|
|
50
42
|
test: /\.json$/i,
|
|
@@ -62,7 +54,7 @@ const getCommonWebpackConfig = (entrypoints, config) => {
|
|
|
62
54
|
}
|
|
63
55
|
const resolvedEntryPoints = {};
|
|
64
56
|
for (const entrypoint of entrypoints) {
|
|
65
|
-
resolvedEntryPoints[entrypoint.name] =
|
|
57
|
+
resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
|
|
66
58
|
}
|
|
67
59
|
return {
|
|
68
60
|
entry: resolvedEntryPoints,
|
|
@@ -75,7 +67,7 @@ const getCommonWebpackConfig = (entrypoints, config) => {
|
|
|
75
67
|
libraryTarget: 'commonjs',
|
|
76
68
|
globalObject: 'this',
|
|
77
69
|
filename: '[name].js',
|
|
78
|
-
path:
|
|
70
|
+
path: config.outputDir
|
|
79
71
|
},
|
|
80
72
|
node: {
|
|
81
73
|
__dirname: true
|
package/out/config/nativeui.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Configuration as WebpackConfig } from 'webpack';
|
|
2
2
|
import { Translations } from '@forge/manifest';
|
|
3
|
-
import { EntryPoint } from './common';
|
|
4
|
-
|
|
3
|
+
import { CommonOutputOptions, EntryPoint } from './common';
|
|
4
|
+
declare type NativeUIConfig = WebpackConfig & Record<'output', CommonOutputOptions>;
|
|
5
|
+
export declare const getNativeUiBuildConfig: (entrypoints: EntryPoint[], i18nConfig?: Translations) => NativeUIConfig;
|
|
6
|
+
export {};
|
|
5
7
|
//# sourceMappingURL=nativeui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../../src/config/nativeui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../../src/config/nativeui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AAExE,aAAK,cAAc,GAAG,aAAa,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,eAAe,YAAY,KAAG,cAyE7F,CAAC"}
|
package/out/config/nativeui.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNativeUiBuildConfig = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
6
|
const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
|
|
8
|
-
const
|
|
7
|
+
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
8
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
9
9
|
const common_1 = require("./common");
|
|
10
10
|
const getNativeUiBuildConfig = (entrypoints, i18nConfig) => {
|
|
11
11
|
const resolvedEntryPoints = {};
|
|
12
12
|
for (const entrypoint of entrypoints) {
|
|
13
|
-
resolvedEntryPoints[entrypoint.name] =
|
|
13
|
+
resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
16
|
entry: {
|
|
@@ -21,7 +21,7 @@ const getNativeUiBuildConfig = (entrypoints, i18nConfig) => {
|
|
|
21
21
|
devtool: 'source-map',
|
|
22
22
|
output: {
|
|
23
23
|
filename: '[name].js',
|
|
24
|
-
path:
|
|
24
|
+
path: (0, cli_shared_1.tmpDir)('native-ui'),
|
|
25
25
|
publicPath: 'auto'
|
|
26
26
|
},
|
|
27
27
|
node: {
|
package/out/config/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseError, FileSystemReader, UserError } from '@forge/cli-shared';
|
|
2
|
-
import { CommonWebpackConfig, ConfigBuilder,
|
|
2
|
+
import { CommonWebpackConfig, ConfigBuilder, EntryPoint } from './common';
|
|
3
3
|
export declare const NODE_WEBPACK_CONFIG_NAME = "node-runtime";
|
|
4
4
|
export declare const NODE_WEBPACK_USER_CODE_DIR = "bundled";
|
|
5
5
|
export declare const NODE_RUNTIME_VERSION_FILE = "runtime.json";
|
|
@@ -35,5 +35,5 @@ export declare class NetworkWrapperProvider implements WrapperProvider {
|
|
|
35
35
|
export declare const getWrapperProvider: ({ fileSystemReader }: {
|
|
36
36
|
fileSystemReader: FileSystemReader;
|
|
37
37
|
}) => LocalWrapperProvider | NetworkWrapperProvider;
|
|
38
|
-
export declare const getNodeRuntimeBuildConfig: (wrapperProvider: WrapperProvider) => (entrypoints:
|
|
38
|
+
export declare const getNodeRuntimeBuildConfig: (wrapperProvider: WrapperProvider) => (entrypoints: EntryPoint[], config: ConfigBuilder) => CommonWebpackConfig;
|
|
39
39
|
//# sourceMappingURL=node.d.ts.map
|
package/out/config/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAA6C,MAAM,mBAAmB,CAAC;AAEtH,OAAO,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAA6C,MAAM,mBAAmB,CAAC;AAEtH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAA0C,MAAM,UAAU,CAAC;AAElH,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,0BAA0B,YAAY,CAAC;AACpD,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAWxD,qBAAa,yBAA0B,SAAQ,SAAS;;CAIvD;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS;CAG3D;AAED,oBAAY,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACjD;AAED,qBAAa,oBAAqB,YAAW,eAAe;IAExD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,MAAM;IAEzB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAUtD;AAED,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,OAAO,CAA4B;IAC3C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;;YAKX,uBAAuB;IAS/B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAuCtD;AAED,eAAO,MAAM,kBAAkB;sBAA8C,gBAAgB;mDAQ5F,CAAC;AAEF,eAAO,MAAM,yBAAyB,oBAClB,eAAe,mBACnB,UAAU,EAAE,UAAU,aAAa,KAAG,mBA4DnD,CAAC"}
|
package/out/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Bundler,
|
|
2
|
-
export { getSandboxBundler, getNodeBundler, nativeUiBundle,
|
|
3
|
-
export { EntryPoint,
|
|
1
|
+
export { Bundler, WatcherMonitor, BundlerOutput } from './types';
|
|
2
|
+
export { getSandboxBundler, getNodeBundler, nativeUiBundle, getCompiler, handleWebpackCompilationResult, runLinter } from './webpack';
|
|
3
|
+
export { EntryPoint, getEntryPoints } from './config/common';
|
|
4
4
|
export { getNativeUiBuildConfig } from './config/nativeui';
|
|
5
5
|
export { getNodeRuntimeBuildConfig, getWrapperProvider, LocalWrapperProvider } from './config/node';
|
|
6
6
|
export { getSandboxedRuntimeBuildConfig } from './config/sandbox';
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,WAAW,EACX,8BAA8B,EAC9B,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSandboxedRuntimeBuildConfig = exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNodeRuntimeBuildConfig = exports.getNativeUiBuildConfig = exports.getEntryPoints = exports.runLinter = exports.handleWebpackCompilationResult = exports.
|
|
3
|
+
exports.getSandboxedRuntimeBuildConfig = exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNodeRuntimeBuildConfig = exports.getNativeUiBuildConfig = exports.getEntryPoints = exports.runLinter = exports.handleWebpackCompilationResult = exports.getCompiler = exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = void 0;
|
|
4
4
|
var webpack_1 = require("./webpack");
|
|
5
5
|
Object.defineProperty(exports, "getSandboxBundler", { enumerable: true, get: function () { return webpack_1.getSandboxBundler; } });
|
|
6
6
|
Object.defineProperty(exports, "getNodeBundler", { enumerable: true, get: function () { return webpack_1.getNodeBundler; } });
|
|
7
7
|
Object.defineProperty(exports, "nativeUiBundle", { enumerable: true, get: function () { return webpack_1.nativeUiBundle; } });
|
|
8
|
-
Object.defineProperty(exports, "watch", { enumerable: true, get: function () { return webpack_1.watch; } });
|
|
9
8
|
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
9
|
Object.defineProperty(exports, "handleWebpackCompilationResult", { enumerable: true, get: function () { return webpack_1.handleWebpackCompilationResult; } });
|
|
12
10
|
Object.defineProperty(exports, "runLinter", { enumerable: true, get: function () { return webpack_1.runLinter; } });
|
|
13
11
|
var common_1 = require("./config/common");
|
package/out/types.d.ts
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import { Logger } from '@forge/cli-shared';
|
|
2
2
|
import { Translations } from '@forge/manifest';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { EntryPoint } from './config/common';
|
|
4
|
+
export declare type BundlerMetadata = {
|
|
5
|
+
modules?: string[];
|
|
6
|
+
nodeRuntimeVersion?: string;
|
|
7
7
|
};
|
|
8
8
|
export interface BundlerOutput {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
metadata?: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
9
|
+
outputDir: string;
|
|
10
|
+
metadata?: BundlerMetadata;
|
|
14
11
|
}
|
|
15
12
|
export declare type BundleLogger = Pick<Logger, 'info' | 'warn'>;
|
|
16
|
-
export declare type Bundler
|
|
17
|
-
export declare type InDiskBundler = (logger: BundleLogger, entrypoints: EntryPoint[], i18nConfig?: Translations) => Promise<{
|
|
18
|
-
outputDir: string;
|
|
19
|
-
}>;
|
|
20
|
-
export declare type WatcherCallback = (err: Error | null, output?: BundlerOutput) => void;
|
|
13
|
+
export declare type Bundler = (logger: BundleLogger, appDirectory: string, endpointPath: EntryPoint[], i18nConfig?: Translations) => Promise<BundlerOutput>;
|
|
21
14
|
export interface WatcherMonitor {
|
|
22
15
|
stop(): void;
|
|
23
16
|
}
|
|
24
|
-
export declare type WatchRun = (compiler: Compiler, ...args: any[]) => void;
|
|
25
|
-
export declare type Watcher = (logger: Logger, endpointPath: EntryPoint[], isDebugMode: boolean, callback: WatcherCallback, watchRun?: WatchRun) => WatcherMonitor;
|
|
26
17
|
//# sourceMappingURL=types.d.ts.map
|
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,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,oBAAY,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,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,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzD,oBAAY,OAAO,GAAG,CACpB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,UAAU,CAAC,EAAE,YAAY,KACtB,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;CACd"}
|
package/out/webpack.d.ts
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import webpack, { Compiler, Configuration as WebpackConfig } from 'webpack';
|
|
3
|
-
import { Bundler, Watcher, InDiskBundler, BundlerOutput, BundleLogger } from './types';
|
|
1
|
+
import webpack from 'webpack';
|
|
4
2
|
import { FileSystemReader, FileSystemWriter } from '@forge/cli-shared';
|
|
5
3
|
import { LintLogger } from '@forge/lint';
|
|
6
|
-
import { CommonWebpackConfig, ConfigBuilder, EntryPoint
|
|
4
|
+
import { CommonWebpackConfig, ConfigBuilder, EntryPoint } from './config/common';
|
|
7
5
|
import { WrapperProvider } from './config/node';
|
|
8
|
-
|
|
6
|
+
import { Bundler, BundleLogger, BundlerMetadata } from './types';
|
|
9
7
|
export declare function handleWebpackCompilationResult(logger: BundleLogger, err: Error | null | undefined, stats: webpack.Stats | undefined): asserts stats is webpack.Stats;
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
writeToDisk?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare const getCompiler: (webpackConfig: WebpackConfig, options?: CompilerOptions) => Compiler;
|
|
8
|
+
export declare function getCompiler(config: webpack.Configuration): webpack.Compiler;
|
|
9
|
+
export declare function getMetadata(config: CommonWebpackConfig, stats?: webpack.Stats): BundlerMetadata;
|
|
15
10
|
export declare const runLinter: (logger?: LintLogger, fileSystemReader?: FileSystemReader, fileSystemWriter?: FileSystemWriter) => Promise<void>;
|
|
16
|
-
export declare
|
|
17
|
-
export declare function createBundler<EP extends EntryPoint = EntryPoint>(getBuildConfig: (entrypoints: EP[], configBuilder: ConfigBuilder) => CommonWebpackConfig): Bundler<EP>;
|
|
11
|
+
export declare function createBundler(getBuildConfig: (entrypoints: EntryPoint[], configBuilder: ConfigBuilder) => CommonWebpackConfig): Bundler;
|
|
18
12
|
export declare const getSandboxBundler: () => Bundler;
|
|
19
|
-
export declare const getNodeBundler: (wrapperProvider: WrapperProvider) => Bundler
|
|
20
|
-
export declare const nativeUiBundle:
|
|
13
|
+
export declare const getNodeBundler: (wrapperProvider: WrapperProvider) => Bundler;
|
|
14
|
+
export declare const nativeUiBundle: Bundler;
|
|
21
15
|
//# sourceMappingURL=webpack.d.ts.map
|
package/out/webpack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAEL,gBAAgB,EAGhB,gBAAgB,EAIjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAIL,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,SAAS,GAC/B,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAkChC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAE3E;AAqBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,GAAG,eAAe,CAY/F;AAED,eAAO,MAAM,SAAS,YAEZ,UAAU,+EAGjB,QAAQ,IAAI,CA+Bd,CAAC;AAEF,wBAAgB,aAAa,CAC3B,cAAc,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,aAAa,EAAE,aAAa,KAAK,mBAAmB,GAC/F,OAAO,CAyBT;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,OAA6D,CAAC;AACpG,eAAO,MAAM,cAAc,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,OACR,CAAC;AAE5D,eAAO,MAAM,cAAc,EAAE,OAqB5B,CAAC"}
|
package/out/webpack.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = exports.createBundler = exports.
|
|
3
|
+
exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = exports.createBundler = exports.runLinter = exports.getMetadata = exports.getCompiler = exports.handleWebpackCompilationResult = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
5
|
+
const fs_1 = require("fs");
|
|
7
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const
|
|
7
|
+
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
9
8
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
9
|
const lint_1 = require("@forge/lint");
|
|
11
|
-
const sandbox_1 = require("./config/sandbox");
|
|
12
|
-
const node_1 = require("./config/node");
|
|
13
10
|
const nativeui_1 = require("./config/nativeui");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
};
|
|
11
|
+
const node_1 = require("./config/node");
|
|
12
|
+
const sandbox_1 = require("./config/sandbox");
|
|
13
|
+
const text_1 = require("./text");
|
|
18
14
|
function handleWebpackCompilationResult(logger, err, stats) {
|
|
19
15
|
if (err) {
|
|
20
16
|
throw err;
|
|
@@ -42,45 +38,11 @@ function handleWebpackCompilationResult(logger, err, stats) {
|
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
exports.handleWebpackCompilationResult = handleWebpackCompilationResult;
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
sourceMap[mapFileName] = readMemoryFileSync(fileSystem, mapFileName);
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
}
|
|
41
|
+
function getCompiler(config) {
|
|
42
|
+
return (0, webpack_1.default)(config);
|
|
52
43
|
}
|
|
53
|
-
function getInMemoryBundle(config, fileSystem) {
|
|
54
|
-
const output = {}, sourceMap = {};
|
|
55
|
-
const outputFileSystem = fileSystem || compilerOutputFileSystem;
|
|
56
|
-
const fileNamePattern = config.output?.filename ?? '[name].js';
|
|
57
|
-
for (const name in config.entry) {
|
|
58
|
-
const fileName = fileNamePattern.replace('[name]', name);
|
|
59
|
-
output[fileName] = readMemoryFileSync(outputFileSystem, fileName);
|
|
60
|
-
if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME && name.startsWith(node_1.NODE_WEBPACK_USER_CODE_DIR + '/')) {
|
|
61
|
-
const wrapperName = name.slice(node_1.NODE_WEBPACK_USER_CODE_DIR.length + 1);
|
|
62
|
-
const wrapperFileName = `${wrapperName}.cjs`;
|
|
63
|
-
output[wrapperFileName] = readMemoryFileSync(outputFileSystem, wrapperFileName);
|
|
64
|
-
tryReadSourceMapSync(outputFileSystem, sourceMap, wrapperFileName);
|
|
65
|
-
}
|
|
66
|
-
tryReadSourceMapSync(outputFileSystem, sourceMap, fileName);
|
|
67
|
-
}
|
|
68
|
-
const metadata = {};
|
|
69
|
-
if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME) {
|
|
70
|
-
metadata.nodeRuntimeVersion = readMemoryFileSync(outputFileSystem, node_1.NODE_RUNTIME_VERSION_FILE);
|
|
71
|
-
}
|
|
72
|
-
return { output, sourceMap, metadata };
|
|
73
|
-
}
|
|
74
|
-
exports.getInMemoryBundle = getInMemoryBundle;
|
|
75
|
-
const getCompiler = (webpackConfig, options) => {
|
|
76
|
-
const compiler = (0, webpack_1.default)(webpackConfig);
|
|
77
|
-
if (!options?.writeToDisk) {
|
|
78
|
-
compiler.outputFileSystem = compilerOutputFileSystem;
|
|
79
|
-
}
|
|
80
|
-
return compiler;
|
|
81
|
-
};
|
|
82
44
|
exports.getCompiler = getCompiler;
|
|
83
|
-
|
|
45
|
+
function getNodeModuleNames(stats) {
|
|
84
46
|
const { modules } = stats.toJson({ modules: true });
|
|
85
47
|
if (modules) {
|
|
86
48
|
const filteredModuleNames = new Set();
|
|
@@ -98,16 +60,18 @@ const getNodeModuleNames = (stats) => {
|
|
|
98
60
|
});
|
|
99
61
|
return Array.from(filteredModuleNames);
|
|
100
62
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
63
|
+
}
|
|
64
|
+
function getMetadata(config, stats) {
|
|
65
|
+
const metadata = {};
|
|
66
|
+
if (stats) {
|
|
67
|
+
metadata.modules = getNodeModuleNames(stats);
|
|
106
68
|
}
|
|
107
|
-
|
|
108
|
-
|
|
69
|
+
if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME && config.output?.path) {
|
|
70
|
+
metadata.nodeRuntimeVersion = (0, fs_1.readFileSync)(path_1.default.join(config.output.path, node_1.NODE_RUNTIME_VERSION_FILE)).toString();
|
|
109
71
|
}
|
|
72
|
+
return metadata;
|
|
110
73
|
}
|
|
74
|
+
exports.getMetadata = getMetadata;
|
|
111
75
|
const runLinter = async (logger = { info: console.log }, fileSystemReader = new cli_shared_1.FileSystemReader(), fileSystemWriter = new cli_shared_1.FileSystemWriter()) => {
|
|
112
76
|
logger.info(`\n${cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.lint.running)}`);
|
|
113
77
|
const exclude = [...(await (0, cli_shared_1.listGitIgnoreFiles)(fileSystemReader)), '.git', 'node_modules'];
|
|
@@ -135,52 +99,24 @@ const runLinter = async (logger = { info: console.log }, fileSystemReader = new
|
|
|
135
99
|
}
|
|
136
100
|
};
|
|
137
101
|
exports.runLinter = runLinter;
|
|
138
|
-
const watch = (logger, entryPoints, debugMode, callback, watchRun) => {
|
|
139
|
-
const config = (0, sandbox_1.getSandboxedRuntimeBuildConfig)(entryPoints, {
|
|
140
|
-
isWatchMode: true,
|
|
141
|
-
isDebugMode: debugMode,
|
|
142
|
-
appDirectory: process.cwd()
|
|
143
|
-
});
|
|
144
|
-
const compiler = (0, exports.getCompiler)(config);
|
|
145
|
-
if (typeof watchRun === 'function') {
|
|
146
|
-
compiler.hooks.watchRun.tapAsync('watchRun', (watchRunCompiler, watchRunCallback) => {
|
|
147
|
-
watchRun(watchRunCompiler, exports.runLinter, watchRunCallback);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
const watcher = compiler.watch({ poll: 1000 }, (compilerError, stats) => {
|
|
151
|
-
try {
|
|
152
|
-
handleWebpackCompilationResult(logger, compilerError, stats);
|
|
153
|
-
callback(null, getInMemoryBundle(config));
|
|
154
|
-
}
|
|
155
|
-
catch (fileReadError) {
|
|
156
|
-
callback(fileReadError);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return new Monitor(watcher);
|
|
160
|
-
};
|
|
161
|
-
exports.watch = watch;
|
|
162
102
|
function createBundler(getBuildConfig) {
|
|
163
103
|
return (logger, appDirectory, endpoints) => {
|
|
164
|
-
const
|
|
165
|
-
const
|
|
104
|
+
const outputDir = (0, cli_shared_1.tmpDir)('dist');
|
|
105
|
+
const config = getBuildConfig(endpoints, { isWatchMode: false, appDirectory, outputDir });
|
|
106
|
+
const compiler = getCompiler(config);
|
|
166
107
|
return new Promise((resolve, reject) => {
|
|
167
108
|
compiler.run((compilerError, stats) => {
|
|
168
109
|
try {
|
|
169
110
|
handleWebpackCompilationResult(logger, compilerError, stats);
|
|
170
|
-
const result = getInMemoryBundle(config);
|
|
171
111
|
compiler.close((closeError) => {
|
|
172
112
|
if (closeError) {
|
|
173
113
|
reject(closeError);
|
|
174
114
|
}
|
|
175
115
|
});
|
|
176
|
-
|
|
177
|
-
modules: getNodeModuleNames(stats),
|
|
178
|
-
...result.metadata
|
|
179
|
-
};
|
|
180
|
-
resolve(result);
|
|
116
|
+
resolve({ outputDir, metadata: getMetadata(config, stats) });
|
|
181
117
|
}
|
|
182
|
-
catch (
|
|
183
|
-
reject(
|
|
118
|
+
catch (err) {
|
|
119
|
+
reject(err);
|
|
184
120
|
}
|
|
185
121
|
});
|
|
186
122
|
});
|
|
@@ -191,16 +127,14 @@ const getSandboxBundler = () => createBundler(sandbox_1.getSandboxedRuntimeBuild
|
|
|
191
127
|
exports.getSandboxBundler = getSandboxBundler;
|
|
192
128
|
const getNodeBundler = (wrapperProvider) => createBundler((0, node_1.getNodeRuntimeBuildConfig)(wrapperProvider));
|
|
193
129
|
exports.getNodeBundler = getNodeBundler;
|
|
194
|
-
const nativeUiBundle = (logger, entrypoints, i18nConfig) => {
|
|
130
|
+
const nativeUiBundle = (logger, appDirectory, entrypoints, i18nConfig) => {
|
|
195
131
|
const config = (0, nativeui_1.getNativeUiBuildConfig)(entrypoints, i18nConfig);
|
|
196
|
-
const compiler =
|
|
132
|
+
const compiler = getCompiler(config);
|
|
197
133
|
return new Promise((resolve, reject) => {
|
|
198
134
|
compiler.run((compilerError, stats) => {
|
|
199
135
|
try {
|
|
200
136
|
handleWebpackCompilationResult(logger, compilerError, stats);
|
|
201
|
-
resolve({
|
|
202
|
-
outputDir: config.output.path
|
|
203
|
-
});
|
|
137
|
+
resolve({ outputDir: config.output.path });
|
|
204
138
|
}
|
|
205
139
|
catch (err) {
|
|
206
140
|
reject(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "4.19.0-next.
|
|
3
|
+
"version": "4.19.0-next.15",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"@babel/plugin-transform-optional-chaining": "^7.23.4",
|
|
20
20
|
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
|
21
21
|
"@babel/preset-typescript": "^7.23.3",
|
|
22
|
-
"@forge/api": "3.9.2-next.
|
|
22
|
+
"@forge/api": "3.9.2-next.2",
|
|
23
23
|
"@forge/babel-plugin-transform-ui": "1.1.18",
|
|
24
|
-
"@forge/cli-shared": "5.5.0-next.
|
|
25
|
-
"@forge/i18n": "0.0.1-next.
|
|
26
|
-
"@forge/lint": "5.3.3-next.
|
|
27
|
-
"@forge/manifest": "7.7.0-next.
|
|
24
|
+
"@forge/cli-shared": "5.5.0-next.14",
|
|
25
|
+
"@forge/i18n": "0.0.1-next.13",
|
|
26
|
+
"@forge/lint": "5.3.3-next.14",
|
|
27
|
+
"@forge/manifest": "7.7.0-next.14",
|
|
28
28
|
"@forge/util": "1.4.4",
|
|
29
29
|
"assert": "^2.1.0",
|
|
30
30
|
"babel-loader": "^8.3.0",
|