@forge/bundler 5.0.1-next.4 → 5.0.1-next.5
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 +13 -0
- package/out/lint.d.ts +2 -2
- package/out/lint.d.ts.map +1 -1
- package/out/lint.js +2 -2
- package/out/runtime.d.ts +2 -2
- package/out/runtime.d.ts.map +1 -1
- package/out/runtime.js +11 -28
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 5.0.1-next.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 75b7732: Remove feature flag for single wrapper packaging
|
|
8
|
+
- 64befbb: Refactor runtime version manifest check into a linter
|
|
9
|
+
- Updated dependencies [dd7cad7]
|
|
10
|
+
- Updated dependencies [75b7732]
|
|
11
|
+
- Updated dependencies [64befbb]
|
|
12
|
+
- @forge/lint@5.9.0-next.5
|
|
13
|
+
- @forge/cli-shared@7.1.0-next.5
|
|
14
|
+
- @forge/manifest@9.5.0-next.4
|
|
15
|
+
|
|
3
16
|
## 5.0.1-next.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/out/lint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileSystemReader, FileSystemWriter } from '@forge/cli-shared';
|
|
1
|
+
import { FileSystemReader, FileSystemWriter, StatsigService } from '@forge/cli-shared';
|
|
2
2
|
import { LintLogger } from '@forge/lint';
|
|
3
|
-
export declare function runLinter(logger?: LintLogger, fileSystemReader?: FileSystemReader, fileSystemWriter?: FileSystemWriter): Promise<void>;
|
|
3
|
+
export declare function runLinter(statsigService: StatsigService, logger?: LintLogger, fileSystemReader?: FileSystemReader, fileSystemWriter?: FileSystemWriter): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=lint.d.ts.map
|
package/out/lint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gBAAgB,EAGhB,gBAAgB,EAEhB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAIlE,wBAAsB,SAAS,CAC7B,cAAc,EAAE,cAAc,EAE9B,MAAM,GAAE,UAAkC,EAC1C,gBAAgB,mBAAyB,EACzC,gBAAgB,mBAAyB,GACxC,OAAO,CAAC,IAAI,CAAC,CAqCf"}
|
package/out/lint.js
CHANGED
|
@@ -6,7 +6,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
6
6
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
7
7
|
const lint_1 = require("@forge/lint");
|
|
8
8
|
const common_1 = require("./common");
|
|
9
|
-
async function runLinter(logger = { info: console.log }, fileSystemReader = new cli_shared_1.FileSystemReader(), fileSystemWriter = new cli_shared_1.FileSystemWriter()) {
|
|
9
|
+
async function runLinter(statsigService, logger = { info: console.log }, fileSystemReader = new cli_shared_1.FileSystemReader(), fileSystemWriter = new cli_shared_1.FileSystemWriter()) {
|
|
10
10
|
logger.info(`\n${cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.lint.running)}`);
|
|
11
11
|
const exclude = [...(await (0, cli_shared_1.listGitIgnoreFiles)(fileSystemReader)), '.git', common_1.NODE_MODULES_DIR];
|
|
12
12
|
const configFile = new cli_shared_1.ConfigFile(fileSystemReader, fileSystemWriter);
|
|
@@ -19,7 +19,7 @@ async function runLinter(logger = { info: console.log }, fileSystemReader = new
|
|
|
19
19
|
]);
|
|
20
20
|
const csuikFilesToLint = csuikFilesByDirectory.reduce((allFiles, directoryFiles) => allFiles.concat(directoryFiles), []);
|
|
21
21
|
try {
|
|
22
|
-
const lintResults = await (0, lint_1.lint)([...filesToLint, ...csuikFilesToLint], manifest, 'development', logger);
|
|
22
|
+
const lintResults = await (0, lint_1.lint)([...filesToLint, ...csuikFilesToLint], manifest, 'development', logger, statsigService);
|
|
23
23
|
if (lintResults.some((result) => result.size())) {
|
|
24
24
|
logger.info('');
|
|
25
25
|
(0, lint_1.reportLintResults)(logger, lintResults);
|
package/out/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigReader
|
|
1
|
+
import { ConfigReader } from '@forge/cli-shared';
|
|
2
2
|
import { BundleLogger, Bundler, BundlerArgs } from './types';
|
|
3
3
|
import { ConfigWithOutput, WebpackBundler } from './webpack';
|
|
4
4
|
import { WrapperProvider } from './wrapper-provider';
|
|
@@ -8,5 +8,5 @@ export declare class SandboxBundler extends WebpackBundler {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const NODE_RUNTIME_CODE_FILE = "__forge__.cjs";
|
|
10
10
|
export declare function userCodePath(entryKey: string): string;
|
|
11
|
-
export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader
|
|
11
|
+
export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader): Bundler;
|
|
12
12
|
//# sourceMappingURL=runtime.d.ts.map
|
package/out/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAqD,MAAM,mBAAmB,CAAC;AAIpG,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EAKZ,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;AAKD,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAoBtD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAsJD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GACzB,OAAO,CAET"}
|
package/out/runtime.js
CHANGED
|
@@ -30,7 +30,7 @@ function userCodePath(entryKey) {
|
|
|
30
30
|
return path_1.default.join(path_1.default.dirname(entryKey), NODE_WEBPACK_USER_CODE_DIR, path_1.default.basename(entryKey));
|
|
31
31
|
}
|
|
32
32
|
exports.userCodePath = userCodePath;
|
|
33
|
-
async function emitWrapperFiles(provider,
|
|
33
|
+
async function emitWrapperFiles(provider, emit) {
|
|
34
34
|
const wrapper = await provider.getNodeRuntimeWrapper();
|
|
35
35
|
const loader = await provider.getNodeRuntimeLoader();
|
|
36
36
|
let entrypointScript;
|
|
@@ -41,14 +41,7 @@ async function emitWrapperFiles(provider, entrypoints, emit, useSingleWrapper) {
|
|
|
41
41
|
else {
|
|
42
42
|
entrypointScript = wrapper;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
await emit(exports.NODE_RUNTIME_CODE_FILE, entrypointScript.script);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
for (const entrypoint of entrypoints) {
|
|
49
|
-
await emit(`${entrypoint.name}.cjs`, entrypointScript.script);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
44
|
+
await emit(exports.NODE_RUNTIME_CODE_FILE, entrypointScript.script);
|
|
52
45
|
if (process.env.FORGE_RUNTIME_PATH) {
|
|
53
46
|
await emit(NODE_RUNTIME_USE_LOCAL_WRAPPER_FILE, 'Local wrapper used');
|
|
54
47
|
}
|
|
@@ -62,17 +55,12 @@ async function emitI18nFiles(i18nResourceBundle, emit) {
|
|
|
62
55
|
}
|
|
63
56
|
class NodeBundler extends webpack_2.WebpackBundler {
|
|
64
57
|
wrapperProvider;
|
|
65
|
-
|
|
66
|
-
constructor(logger, wrapperProvider, statsigReader) {
|
|
58
|
+
constructor(logger, wrapperProvider) {
|
|
67
59
|
super(logger);
|
|
68
60
|
this.wrapperProvider = wrapperProvider;
|
|
69
|
-
this.statsigReader = statsigReader;
|
|
70
61
|
}
|
|
71
62
|
async getConfig(args) {
|
|
72
63
|
const webpackConfig = (0, common_1.getCommonWebpackConfig)(args);
|
|
73
|
-
if (!(await this.statsigReader.packageSingleWrapper())) {
|
|
74
|
-
webpackConfig.entry = Object.fromEntries(Object.entries(webpackConfig.entry).map(([entryKey, entryPath]) => [userCodePath(entryKey), entryPath]));
|
|
75
|
-
}
|
|
76
64
|
webpackConfig.target = 'node18';
|
|
77
65
|
webpackConfig.output.filename = '[name].cjs';
|
|
78
66
|
webpackConfig.name = 'node-runtime';
|
|
@@ -86,7 +74,7 @@ class NodeBundler extends webpack_2.WebpackBundler {
|
|
|
86
74
|
apply: (compiler) => {
|
|
87
75
|
compiler.hooks.make.tapPromise('AfterEmitPlugin', async (compilation) => {
|
|
88
76
|
const emit = async (name, contents) => compilation.emitAsset(name, new RawSource(contents));
|
|
89
|
-
await emitWrapperFiles(this.wrapperProvider,
|
|
77
|
+
await emitWrapperFiles(this.wrapperProvider, emit);
|
|
90
78
|
if (args.i18nResourceBundle) {
|
|
91
79
|
await emitI18nFiles(args.i18nResourceBundle, emit);
|
|
92
80
|
}
|
|
@@ -98,23 +86,18 @@ class NodeBundler extends webpack_2.WebpackBundler {
|
|
|
98
86
|
}
|
|
99
87
|
class TypeScriptNodeBundler extends typescript_1.TypeScriptBundler {
|
|
100
88
|
wrapperProvider;
|
|
101
|
-
|
|
102
|
-
constructor(logger, wrapperProvider, statsigReader) {
|
|
89
|
+
constructor(logger, wrapperProvider) {
|
|
103
90
|
super(logger);
|
|
104
91
|
this.wrapperProvider = wrapperProvider;
|
|
105
|
-
this.statsigReader = statsigReader;
|
|
106
92
|
}
|
|
107
93
|
async getResult(args, outputDir) {
|
|
108
|
-
if (!(await this.statsigReader.packageSingleWrapper())) {
|
|
109
|
-
throw new cli_shared_1.UserError('Single wrapper feature flag must be enabled to use the TypeScript bundler.');
|
|
110
|
-
}
|
|
111
94
|
const result = await super.getResult(args, outputDir);
|
|
112
95
|
const emit = async (name, contents) => {
|
|
113
96
|
const outputPath = path_1.default.join(outputDir, name);
|
|
114
97
|
await promises_1.default.mkdir(path_1.default.dirname(outputPath), { recursive: true });
|
|
115
98
|
await promises_1.default.writeFile(outputPath, contents);
|
|
116
99
|
};
|
|
117
|
-
await emitWrapperFiles(this.wrapperProvider,
|
|
100
|
+
await emitWrapperFiles(this.wrapperProvider, emit);
|
|
118
101
|
if (args.i18nResourceBundle) {
|
|
119
102
|
await emitI18nFiles(args.i18nResourceBundle, emit);
|
|
120
103
|
}
|
|
@@ -124,11 +107,11 @@ class TypeScriptNodeBundler extends typescript_1.TypeScriptBundler {
|
|
|
124
107
|
class ConfigBundler {
|
|
125
108
|
configReader;
|
|
126
109
|
bundlers;
|
|
127
|
-
constructor(logger, wrapperProvider, configReader
|
|
110
|
+
constructor(logger, wrapperProvider, configReader) {
|
|
128
111
|
this.configReader = configReader;
|
|
129
112
|
this.bundlers = new Map([
|
|
130
|
-
['webpack', new NodeBundler(logger, wrapperProvider
|
|
131
|
-
['typescript', new TypeScriptNodeBundler(logger, wrapperProvider
|
|
113
|
+
['webpack', new NodeBundler(logger, wrapperProvider)],
|
|
114
|
+
['typescript', new TypeScriptNodeBundler(logger, wrapperProvider)]
|
|
132
115
|
]);
|
|
133
116
|
}
|
|
134
117
|
async getBundlerType() {
|
|
@@ -144,7 +127,7 @@ class ConfigBundler {
|
|
|
144
127
|
return (await this.getBundler()).watch(args, watch);
|
|
145
128
|
}
|
|
146
129
|
}
|
|
147
|
-
function getNodeBundler(logger, wrapperProvider, configReader
|
|
148
|
-
return new ConfigBundler(logger, wrapperProvider, configReader
|
|
130
|
+
function getNodeBundler(logger, wrapperProvider, configReader) {
|
|
131
|
+
return new ConfigBundler(logger, wrapperProvider, configReader);
|
|
149
132
|
}
|
|
150
133
|
exports.getNodeBundler = getNodeBundler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "5.0.1-next.
|
|
3
|
+
"version": "5.0.1-next.5",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"@babel/plugin-transform-optional-chaining": "^7.23.4",
|
|
20
20
|
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
|
21
21
|
"@forge/api": "5.3.0",
|
|
22
|
-
"@forge/cli-shared": "7.1.0-next.
|
|
22
|
+
"@forge/cli-shared": "7.1.0-next.5",
|
|
23
23
|
"@forge/i18n": "0.0.6",
|
|
24
|
-
"@forge/lint": "5.9.0-next.
|
|
25
|
-
"@forge/manifest": "9.5.0-next.
|
|
24
|
+
"@forge/lint": "5.9.0-next.5",
|
|
25
|
+
"@forge/manifest": "9.5.0-next.4",
|
|
26
26
|
"@forge/util": "1.4.9",
|
|
27
27
|
"assert": "^2.1.0",
|
|
28
28
|
"babel-loader": "^8.3.0",
|