@dcl/sdk-commands 7.1.4-4546888614.commit-9751782 → 7.1.4-4567379411.commit-066d4ed
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.
@@ -1,3 +1,3 @@
|
|
1
1
|
import { FileSystemInterface } from '@dcl/inspector';
|
2
|
-
import {
|
3
|
-
export declare function
|
2
|
+
import { CliComponents } from '../../../components';
|
3
|
+
export declare function createFileSystemInterfaceFromFsComponent({ fs }: Pick<CliComponents, 'fs'>): FileSystemInterface;
|
@@ -1,30 +1,37 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
6
|
+
exports.createFileSystemInterfaceFromFsComponent = void 0;
|
7
|
+
const path_1 = __importDefault(require("path"));
|
8
|
+
function createFileSystemInterfaceFromFsComponent({ fs }) {
|
5
9
|
return {
|
6
10
|
async existFile(filePath) {
|
7
|
-
|
8
|
-
await fs.access(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
9
|
-
return true;
|
10
|
-
}
|
11
|
-
catch (error) {
|
12
|
-
return false;
|
13
|
-
}
|
11
|
+
return fs.fileExists(filePath);
|
14
12
|
},
|
15
13
|
async readFile(filePath) {
|
16
14
|
return fs.readFile(filePath);
|
17
15
|
},
|
18
16
|
async writeFile(filePath, content) {
|
17
|
+
const folder = path_1.default.dirname(filePath);
|
18
|
+
if (!(await fs.directoryExists(folder))) {
|
19
|
+
await fs.mkdir(folder, { recursive: true });
|
20
|
+
}
|
19
21
|
await fs.writeFile(filePath, content);
|
20
22
|
},
|
21
23
|
async readdir(dirPath) {
|
22
|
-
|
24
|
+
if (dirPath.indexOf('/../') !== -1) {
|
25
|
+
throw new Error('The usage of /../ is not allowed');
|
26
|
+
}
|
27
|
+
const root = dirPath === '.' || dirPath === './' || dirPath === '';
|
28
|
+
const resolvedPath = root ? process.cwd() : dirPath;
|
29
|
+
const result = await fs.readdir(resolvedPath);
|
23
30
|
return Promise.all(result.map(async (name) => ({
|
24
31
|
name: name,
|
25
|
-
isDirectory: await fs.directoryExists(name)
|
32
|
+
isDirectory: await fs.directoryExists(path_1.default.resolve(dirPath, name))
|
26
33
|
})));
|
27
34
|
}
|
28
35
|
};
|
29
36
|
}
|
30
|
-
exports.
|
37
|
+
exports.createFileSystemInterfaceFromFsComponent = createFileSystemInterfaceFromFsComponent;
|
@@ -29,7 +29,7 @@ const rpc_1 = require("@dcl/rpc");
|
|
29
29
|
const codegen = __importStar(require("@dcl/rpc/dist/codegen"));
|
30
30
|
const fs_1 = require("./fs");
|
31
31
|
async function createDataLayer({ fs, logger }) {
|
32
|
-
const dataLayerHost = await (0, inspector_1.createDataLayerHost)((0, fs_1.
|
32
|
+
const dataLayerHost = await (0, inspector_1.createDataLayerHost)((0, fs_1.createFileSystemInterfaceFromFsComponent)({ fs }));
|
33
33
|
const context = {
|
34
34
|
dataLayerHost
|
35
35
|
};
|
package/dist/logic/bundle.d.ts
CHANGED
@@ -19,7 +19,8 @@ export declare function bundleProject(components: BundleComponents, options: Com
|
|
19
19
|
platform: "browser";
|
20
20
|
format: "cjs";
|
21
21
|
preserveSymlinks: false;
|
22
|
-
outfile: string;
|
22
|
+
outfile: string | undefined;
|
23
|
+
outdir: string | undefined;
|
23
24
|
allowOverwrite: false;
|
24
25
|
sourcemap: "external" | "inline";
|
25
26
|
minify: boolean;
|
package/dist/logic/bundle.js
CHANGED
@@ -16,6 +16,7 @@ const path_1 = require("path");
|
|
16
16
|
const beautiful_logs_1 = require("./beautiful-logs");
|
17
17
|
const log_1 = require("../components/log");
|
18
18
|
const url_1 = require("url");
|
19
|
+
const glob_1 = require("glob");
|
19
20
|
const MAX_STEP = 3;
|
20
21
|
async function bundleProject(components, options) {
|
21
22
|
const sceneJson = await (0, scene_validations_1.getValidSceneJson)(components, options.workingDirectory);
|
@@ -30,17 +31,18 @@ async function bundleProject(components, options) {
|
|
30
31
|
if (!(await components.fs.fileExists(tsconfig))) {
|
31
32
|
throw new error_1.CliError(`File ${tsconfig} must exist to compile the Typescript project`);
|
32
33
|
}
|
33
|
-
const input = options.single ?? 'src/index.ts';
|
34
|
+
const input = (0, glob_1.globSync)(options.single ?? 'src/index.ts');
|
34
35
|
const output = !options.single ? sceneJson.main : options.single.replace(/\.ts$/, '.js');
|
35
36
|
const outfile = (0, path_1.join)(options.workingDirectory, output);
|
36
|
-
(0, beautiful_logs_1.printProgressStep)(components.logger, `Bundling file ${log_1.colors.bold(input)}`, 2, MAX_STEP);
|
37
|
+
(0, beautiful_logs_1.printProgressStep)(components.logger, `Bundling file ${log_1.colors.bold(input.join(','))}`, 2, MAX_STEP);
|
37
38
|
const context = await esbuild_1.default.context({
|
38
|
-
entryPoints:
|
39
|
+
entryPoints: input,
|
39
40
|
bundle: true,
|
40
41
|
platform: 'browser',
|
41
42
|
format: 'cjs',
|
42
43
|
preserveSymlinks: false,
|
43
|
-
outfile,
|
44
|
+
outfile: input.length > 1 ? undefined : outfile,
|
45
|
+
outdir: input.length > 1 ? (0, path_1.dirname)(outfile) : undefined,
|
44
46
|
allowOverwrite: false,
|
45
47
|
sourcemap: options.production ? 'external' : 'inline',
|
46
48
|
minify: options.production,
|
@@ -71,17 +73,20 @@ async function bundleProject(components, options) {
|
|
71
73
|
});
|
72
74
|
if (options.watch) {
|
73
75
|
await context.watch({});
|
76
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Bundle saved ${log_1.colors.bold(output)}`);
|
74
77
|
}
|
75
78
|
else {
|
76
79
|
try {
|
77
|
-
await context.rebuild();
|
80
|
+
const ctx = await context.rebuild();
|
81
|
+
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Bundle saved ${log_1.colors.bold(Object.keys(ctx.metafile.outputs)
|
82
|
+
.filter((_) => _.endsWith('.js'))
|
83
|
+
.join(',') || outfile)}`);
|
78
84
|
}
|
79
85
|
catch (err) {
|
80
86
|
throw new error_1.CliError(err.toString());
|
81
87
|
}
|
82
88
|
await context.dispose();
|
83
89
|
}
|
84
|
-
(0, beautiful_logs_1.printProgressInfo)(components.logger, `Bundle saved ${log_1.colors.bold(output)}`);
|
85
90
|
if (options.watch)
|
86
91
|
(0, beautiful_logs_1.printProgressInfo)(components.logger, `The compiler is watching for changes`);
|
87
92
|
await runTypeChecker(components, options);
|
package/package.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk-commands",
|
3
3
|
"description": "",
|
4
|
-
"version": "7.1.4-
|
4
|
+
"version": "7.1.4-4567379411.commit-066d4ed",
|
5
5
|
"author": "Decentraland",
|
6
6
|
"bin": {
|
7
7
|
"sdk-commands": "./dist/index.js"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
10
|
"@dcl/hashing": "1.1.3",
|
11
|
-
"@dcl/inspector": "7.1.4-
|
11
|
+
"@dcl/inspector": "7.1.4-4567379411.commit-066d4ed",
|
12
12
|
"@dcl/linker-dapp": "0.7.0",
|
13
13
|
"@dcl/mini-comms": "1.0.1-20230216163137.commit-a4c75be",
|
14
14
|
"@dcl/protocol": "1.0.0-4493564897.commit-c858f8a",
|
@@ -60,5 +60,5 @@
|
|
60
60
|
"displayName": "SDK",
|
61
61
|
"tsconfig": "./tsconfig.json"
|
62
62
|
},
|
63
|
-
"commit": "
|
63
|
+
"commit": "066d4ed39460adc93eeca9241e8d13724a60a240"
|
64
64
|
}
|