@gravity-ui/app-builder 0.28.1-beta.7 → 0.28.1-beta.8
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.
|
@@ -10,21 +10,11 @@ const paths_1 = __importDefault(require("../../../common/paths"));
|
|
|
10
10
|
const utils_1 = require("../../../common/utils");
|
|
11
11
|
function createSWCBuildScript(config) {
|
|
12
12
|
return `
|
|
13
|
-
let swcCli;
|
|
14
|
-
try {
|
|
15
|
-
swcCli = require('@swc/cli');
|
|
16
|
-
} catch (e) {
|
|
17
|
-
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
18
|
-
throw e;
|
|
19
|
-
}
|
|
20
|
-
swcCli = require(${JSON.stringify(require.resolve('@swc/cli'))});
|
|
21
|
-
}
|
|
22
|
-
const {swcDir} = swcCli;
|
|
23
13
|
const {Logger} = require(${JSON.stringify(require.resolve('../../../common/logger'))});
|
|
24
14
|
const {compile} = require(${JSON.stringify(require.resolve('../../../common/swc/compile'))});
|
|
25
15
|
|
|
26
16
|
const logger = new Logger('server', ${config.verbose});
|
|
27
|
-
compile(
|
|
17
|
+
compile({
|
|
28
18
|
logger,
|
|
29
19
|
outputPath: ${JSON.stringify(paths_1.default.appDist)},
|
|
30
20
|
projectPath: ${JSON.stringify(paths_1.default.appServer)},
|
|
@@ -61,22 +61,11 @@ watch(
|
|
|
61
61
|
}
|
|
62
62
|
function createSWCBuildScript(config) {
|
|
63
63
|
return `
|
|
64
|
-
let swcCli;
|
|
65
|
-
try {
|
|
66
|
-
swcCli = require('@swc/cli');
|
|
67
|
-
} catch (e) {
|
|
68
|
-
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
69
|
-
throw e;
|
|
70
|
-
}
|
|
71
|
-
swcCli = require(${JSON.stringify(require.resolve('@swc/cli'))});
|
|
72
|
-
}
|
|
73
|
-
const {swcDir} = swcCli;
|
|
74
64
|
const {Logger} = require(${JSON.stringify(require.resolve('../../common/logger'))});
|
|
75
65
|
const {watch} = require(${JSON.stringify(require.resolve('../../common/swc/watch'))});
|
|
76
66
|
|
|
77
67
|
const logger = new Logger('server', ${config.verbose});
|
|
78
68
|
watch(
|
|
79
|
-
swcDir,
|
|
80
69
|
${JSON.stringify(paths_1.default.appServer)},
|
|
81
70
|
{
|
|
82
71
|
outputPath: ${JSON.stringify(paths_1.default.appDist)},
|
|
@@ -5,5 +5,5 @@ interface SwcCompileOptions {
|
|
|
5
5
|
logger: Logger;
|
|
6
6
|
enableSourceMap?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function compile(
|
|
8
|
+
export declare function compile({ projectPath, outputPath, logger, enableSourceMap, }: SwcCompileOptions): Promise<void>;
|
|
9
9
|
export {};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compile = compile;
|
|
4
4
|
const pretty_time_1 = require("../logger/pretty-time");
|
|
5
|
+
// @ts-ignore @swc/cli is not typed
|
|
6
|
+
const cli_1 = require("@swc/cli");
|
|
5
7
|
const getSwcConfig = (enableSourceMap = false) => {
|
|
6
8
|
return {
|
|
7
9
|
module: {
|
|
@@ -16,9 +18,7 @@ const getSwcConfig = (enableSourceMap = false) => {
|
|
|
16
18
|
sourceMaps: enableSourceMap,
|
|
17
19
|
};
|
|
18
20
|
};
|
|
19
|
-
async function compile(
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
-
swcDir, { projectPath, outputPath, logger, enableSourceMap = false }) {
|
|
21
|
+
async function compile({ projectPath, outputPath, logger, enableSourceMap = false, }) {
|
|
22
22
|
const start = process.hrtime.bigint();
|
|
23
23
|
logger.message('Start compilation');
|
|
24
24
|
const swcConfig = getSwcConfig(enableSourceMap);
|
|
@@ -49,7 +49,7 @@ swcDir, { projectPath, outputPath, logger, enableSourceMap = false }) {
|
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
51
|
try {
|
|
52
|
-
swcDir({
|
|
52
|
+
(0, cli_1.swcDir)({
|
|
53
53
|
cliOptions,
|
|
54
54
|
swcOptions: swcConfig,
|
|
55
55
|
callbacks,
|
|
@@ -5,5 +5,5 @@ interface SwcWatchOptions {
|
|
|
5
5
|
onAfterFilesEmitted?: () => void;
|
|
6
6
|
enableSourceMap?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function watch(
|
|
8
|
+
export declare function watch(projectPath: string, { outputPath, logger, onAfterFilesEmitted, enableSourceMap }: SwcWatchOptions): Promise<void>;
|
|
9
9
|
export {};
|
package/dist/common/swc/watch.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.watch = watch;
|
|
4
|
+
// @ts-ignore @swc/cli is not typed
|
|
5
|
+
const cli_1 = require("@swc/cli");
|
|
4
6
|
const getSwcConfig = (enableSourceMap = false) => {
|
|
5
7
|
return {
|
|
6
8
|
module: {
|
|
@@ -15,9 +17,7 @@ const getSwcConfig = (enableSourceMap = false) => {
|
|
|
15
17
|
sourceMaps: enableSourceMap,
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
|
-
async function watch(
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
swcDir, projectPath, { outputPath, logger, onAfterFilesEmitted, enableSourceMap = false }) {
|
|
20
|
+
async function watch(projectPath, { outputPath, logger, onAfterFilesEmitted, enableSourceMap = false }) {
|
|
21
21
|
logger.message('Start compilation in watch mode');
|
|
22
22
|
const swcConfig = getSwcConfig(enableSourceMap);
|
|
23
23
|
const cliOptions = {
|
|
@@ -52,7 +52,7 @@ swcDir, projectPath, { outputPath, logger, onAfterFilesEmitted, enableSourceMap
|
|
|
52
52
|
logger.message('Watching for file changes');
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
|
-
swcDir({
|
|
55
|
+
(0, cli_1.swcDir)({
|
|
56
56
|
cliOptions,
|
|
57
57
|
swcOptions: swcConfig,
|
|
58
58
|
callbacks,
|
package/package.json
CHANGED