@gravity-ui/app-builder 0.28.1-beta.8 → 0.28.1-beta.9

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.
@@ -73,7 +73,6 @@ watch(
73
73
  onAfterFilesEmitted: () => {
74
74
  process.send({type: 'Emitted'});
75
75
  },
76
- enableSourceMap: true
77
76
  }
78
77
  );`;
79
78
  }
@@ -3,7 +3,6 @@ interface SwcCompileOptions {
3
3
  projectPath: string;
4
4
  outputPath: string;
5
5
  logger: Logger;
6
- enableSourceMap?: boolean;
7
6
  }
8
- export declare function compile({ projectPath, outputPath, logger, enableSourceMap, }: SwcCompileOptions): Promise<void>;
7
+ export declare function compile({ projectPath, outputPath, logger }: SwcCompileOptions): Promise<void>;
9
8
  export {};
@@ -4,29 +4,15 @@ exports.compile = compile;
4
4
  const pretty_time_1 = require("../logger/pretty-time");
5
5
  // @ts-ignore @swc/cli is not typed
6
6
  const cli_1 = require("@swc/cli");
7
- const getSwcConfig = (enableSourceMap = false) => {
8
- return {
9
- module: {
10
- type: 'commonjs',
11
- },
12
- jsc: {
13
- target: 'es2020',
14
- parser: {
15
- syntax: 'typescript',
16
- },
17
- },
18
- sourceMaps: enableSourceMap,
19
- };
20
- };
21
- async function compile({ projectPath, outputPath, logger, enableSourceMap = false, }) {
7
+ const utils_1 = require("./utils");
8
+ async function compile({ projectPath, outputPath, logger }) {
22
9
  const start = process.hrtime.bigint();
23
10
  logger.message('Start compilation');
24
- const swcConfig = getSwcConfig(enableSourceMap);
11
+ const swcOptions = (0, utils_1.getSwcOptionsFromTsconfig)(projectPath);
25
12
  const cliOptions = {
26
13
  filenames: [projectPath],
27
14
  outDir: outputPath,
28
15
  watch: false,
29
- sourceMaps: enableSourceMap,
30
16
  extensions: ['.js', '.ts', '.mjs', '.cjs'],
31
17
  stripLeadingPaths: true,
32
18
  sync: false,
@@ -51,7 +37,7 @@ async function compile({ projectPath, outputPath, logger, enableSourceMap = fals
51
37
  try {
52
38
  (0, cli_1.swcDir)({
53
39
  cliOptions,
54
- swcOptions: swcConfig,
40
+ swcOptions,
55
41
  callbacks,
56
42
  });
57
43
  }
@@ -0,0 +1 @@
1
+ export declare function getSwcOptionsFromTsconfig(projectPath: string, filename?: string): import("@swc/types").Options;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSwcOptionsFromTsconfig = getSwcOptionsFromTsconfig;
4
+ const tsconfig_to_swcconfig_1 = require("tsconfig-to-swcconfig");
5
+ function getSwcOptionsFromTsconfig(projectPath, filename = 'tsconfig.json') {
6
+ return (0, tsconfig_to_swcconfig_1.convert)(filename, projectPath);
7
+ }
@@ -3,7 +3,6 @@ interface SwcWatchOptions {
3
3
  outputPath: string;
4
4
  logger: Logger;
5
5
  onAfterFilesEmitted?: () => void;
6
- enableSourceMap?: boolean;
7
6
  }
8
- export declare function watch(projectPath: string, { outputPath, logger, onAfterFilesEmitted, enableSourceMap }: SwcWatchOptions): Promise<void>;
7
+ export declare function watch(projectPath: string, { outputPath, logger, onAfterFilesEmitted }: SwcWatchOptions): Promise<void>;
9
8
  export {};
@@ -3,28 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.watch = watch;
4
4
  // @ts-ignore @swc/cli is not typed
5
5
  const cli_1 = require("@swc/cli");
6
- const getSwcConfig = (enableSourceMap = false) => {
7
- return {
8
- module: {
9
- type: 'commonjs',
10
- },
11
- jsc: {
12
- target: 'es2020',
13
- parser: {
14
- syntax: 'typescript',
15
- },
16
- },
17
- sourceMaps: enableSourceMap,
18
- };
19
- };
20
- async function watch(projectPath, { outputPath, logger, onAfterFilesEmitted, enableSourceMap = false }) {
6
+ const utils_1 = require("./utils");
7
+ async function watch(projectPath, { outputPath, logger, onAfterFilesEmitted }) {
21
8
  logger.message('Start compilation in watch mode');
22
- const swcConfig = getSwcConfig(enableSourceMap);
9
+ const swcOptions = (0, utils_1.getSwcOptionsFromTsconfig)(projectPath);
23
10
  const cliOptions = {
24
11
  filenames: [projectPath],
25
12
  outDir: outputPath,
26
13
  watch: true,
27
- sourceMaps: enableSourceMap,
28
14
  extensions: ['.js', '.ts', '.mjs', '.cjs'],
29
15
  stripLeadingPaths: true,
30
16
  sync: false,
@@ -54,7 +40,7 @@ async function watch(projectPath, { outputPath, logger, onAfterFilesEmitted, ena
54
40
  };
55
41
  (0, cli_1.swcDir)({
56
42
  cliOptions,
57
- swcOptions: swcConfig,
43
+ swcOptions,
58
44
  callbacks,
59
45
  });
60
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.28.1-beta.8",
3
+ "version": "0.28.1-beta.9",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -82,7 +82,7 @@
82
82
  "@svgr/core": "^8.1.0",
83
83
  "@svgr/plugin-jsx": "^8.1.0",
84
84
  "@svgr/webpack": "^8.1.0",
85
- "@swc/cli": "^0.7.8",
85
+ "@swc/cli": "0.7.7",
86
86
  "@swc/core": "1.11.24",
87
87
  "@swc/plugin-transform-imports": "7.0.3",
88
88
  "babel-loader": "^9.2.1",
@@ -136,6 +136,7 @@
136
136
  "terser-webpack-plugin": "5.3.10",
137
137
  "ts-checker-rspack-plugin": "^1.1.1",
138
138
  "ts-node": "10.9.2",
139
+ "tsconfig-to-swcconfig": "^2.8.1",
139
140
  "tslib": "^2.6.2",
140
141
  "typescript": "~5.6.0",
141
142
  "webpack": "^5.95.0",