npm package diff
Package: @forge/cli
Versions: 10.6.0-next.14 - 10.6.0-next.15
File: package/out/deploy/packager/runtime-bundler.js
Index: package/out/deploy/packager/runtime-bundler.js
===================================================================
--- package/out/deploy/packager/runtime-bundler.js
+++ package/out/deploy/packager/runtime-bundler.js
@@ -1,23 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeRuntimeBundler = exports.SandboxRuntimeBundler = exports.RuntimeBundler = void 0;
-const fs_1 = require("fs");
+const tslib_1 = require("tslib");
+const path_1 = tslib_1.__importDefault(require("path"));
const bundler_1 = require("@forge/bundler");
const cli_shared_1 = require("@forge/cli-shared");
const i18n_1 = require("@forge/i18n");
const packager_1 = require("./packager");
const node_1 = require("@forge/bundler/out/config/node");
-const path_1 = require("path");
+const path_2 = require("path");
class RuntimeBundler {
archiverFactory;
logger;
bundler;
+ fileSystemReader;
configFile;
- constructor(archiverFactory, logger, bundler, configFile) {
+ constructor(archiverFactory, logger, bundler, fileSystemReader, configFile) {
this.archiverFactory = archiverFactory;
this.logger = logger;
this.bundler = bundler;
+ this.fileSystemReader = fileSystemReader;
this.configFile = configFile;
}
async packageCode(archiver, entryPoints) {
const moduleList = [];
@@ -28,9 +31,9 @@
}
catch (e) {
throw new packager_1.BundlerError(e.message);
}
- const { output, sourceMap = {}, metadata } = bundlerResponse;
+ const { outputDir, metadata } = bundlerResponse;
if (metadata) {
if (metadata.modules) {
moduleList.push(...metadata.modules);
}
@@ -38,26 +41,20 @@
archiver.addFile(node_1.NODE_RUNTIME_VERSION_FILE, Buffer.from(metadata.nodeRuntimeVersion));
}
}
this.logger.debug(cli_shared_1.Text.deploy.taskPackage.packageBundledFiles);
- for (const name in output) {
- archiver.addFile(name, Buffer.from(output[name]));
+ for (const name of await this.fileSystemReader.getFileGlobList([`${outputDir}/**`])) {
+ archiver.addFileFrom(path_1.default.relative(outputDir, name), name);
}
- for (const name in sourceMap) {
- archiver.addFile(name, Buffer.from(sourceMap[name]));
- }
}
return moduleList;
}
async packageDependencies(archiver) {
+ archiver.addFile(cli_shared_1.manifestFileName, Buffer.from(this.configFile.readConfigAsString()));
for (const fileName of cli_shared_1.dependencyFileNames) {
- if (!(0, fs_1.existsSync)(fileName)) {
+ if (!this.fileSystemReader.fileExists(fileName)) {
continue;
}
- if (fileName === cli_shared_1.manifestFileName) {
- archiver.addFile(fileName, Buffer.from(this.configFile.readConfigAsString()));
- continue;
- }
archiver.addFileFrom(fileName, fileName);
}
}
async packageAll(archiver, handlers, packageConfig) {
@@ -67,9 +64,9 @@
return moduleList;
}
packageI18nResources(archiver, i18nResourceBundle) {
(0, cli_shared_1.listFilesInI18nResourceBundle)(i18nResourceBundle).forEach(([fileName, filePath]) => {
- archiver.addFileFrom((0, path_1.join)(i18n_1.I18N_BUNDLE_FOLDER_NAME, fileName), filePath);
+ archiver.addFileFrom((0, path_2.join)(i18n_1.I18N_BUNDLE_FOLDER_NAME, fileName), filePath);
});
}
async bundle(handlers, i18nResourceBundle, packageConfig) {
const archiver = this.archiverFactory();
@@ -92,12 +89,12 @@
exports.SandboxRuntimeBundler = SandboxRuntimeBundler;
class NodeRuntimeBundler extends RuntimeBundler {
async packageAll(archiver, handlers, packageConfig) {
const moduleList = await super.packageAll(archiver, handlers, packageConfig);
- const files = await new cli_shared_1.FileSystemReader().getFileGlobList(packageConfig?.extraFiles ?? []);
- files.forEach((fileName) => {
+ const files = await this.fileSystemReader.getFileGlobList(packageConfig?.extraFiles ?? []);
+ for (const fileName of files) {
archiver.addFileFrom(fileName, fileName);
- });
+ }
return moduleList;
}
}
exports.NodeRuntimeBundler = NodeRuntimeBundler;