@ixon-cdk/svelte-builder 1.1.0-next.2 → 1.1.0-next.3

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.
Files changed (3) hide show
  1. package/browser.js +27 -16
  2. package/index.js +3 -3
  3. package/package.json +2 -2
package/browser.js CHANGED
@@ -48,7 +48,7 @@ async function _build(inputFile, outputFile, tag, assets, production, watch) {
48
48
  name: 'app',
49
49
  fileName: () => `${tag}.min.js`,
50
50
  },
51
- sourcemap: true,
51
+ sourcemap: !production,
52
52
  outDir: outputDir,
53
53
  emptyOutDir: false,
54
54
  rollupOptions: {
@@ -66,7 +66,7 @@ async function _build(inputFile, outputFile, tag, assets, production, watch) {
66
66
  immutable: true,
67
67
  tag,
68
68
  },
69
- preprocess: preprocess(),
69
+ preprocess: preprocess({ sourceMap: !production }),
70
70
  }),
71
71
  ],
72
72
  };
@@ -74,26 +74,37 @@ async function _build(inputFile, outputFile, tag, assets, production, watch) {
74
74
  const buildConfig = { ...config };
75
75
 
76
76
  if (moduleExists('@tsconfig/svelte/package.json')) {
77
- const typescriptPlugin = typescript({
78
- sourceMap: !production,
79
- outDir: outputDir,
80
- });
81
- const typeCheckPlugin = typeCheck({
82
- tsconfig: `${inputDir}/tsconfig.json`,
83
- });
84
-
85
- config.plugins.push(typescriptPlugin);
86
- buildConfig.plugins.push(typeCheckPlugin, typescriptPlugin);
77
+ const tsConfig = `${inputDir}/tsconfig.json`;
78
+ if (fs.existsSync(tsConfig)) {
79
+ const typescriptPlugin = typescript({
80
+ sourceMap: !production,
81
+ outDir: outputDir,
82
+ });
83
+ const typeCheckPlugin = typeCheck({ tsConfig });
84
+ config.plugins.push(typescriptPlugin);
85
+ buildConfig.plugins.push(typeCheckPlugin, typescriptPlugin);
86
+ }
87
87
  }
88
88
 
89
89
  // build
90
- await build(buildConfig);
91
- copyAssets(assets, inputDir, outputDir);
90
+ process.on('uncaughtException', () => {
91
+ // NOP: builder will show an error
92
+ });
93
+
94
+ if (!watch) {
95
+ try {
96
+ await build(buildConfig);
97
+ copyAssets(assets, inputDir, outputDir);
98
+ fs.unlinkSync(entryFileName);
99
+ } catch (e) {
100
+ // NOP: builder will show an error
101
+ }
102
+ }
92
103
 
93
104
  // watch source files
94
105
  if (watch) {
95
106
  watchAssets(assets, inputDir, outputDir);
96
- await watchInputDir(inputDir, (isAsset) => {
107
+ await watchInputDir(inputDir, isAsset => {
97
108
  if (isAsset) {
98
109
  // do nothing
99
110
  } else {
@@ -102,7 +113,7 @@ async function _build(inputFile, outputFile, tag, assets, production, watch) {
102
113
  });
103
114
  process.on('SIGINT', () => {
104
115
  fs.unlinkSync(entryFileName);
105
- process.exit();
116
+ process.exit(1);
106
117
  });
107
118
  }
108
119
  }
package/index.js CHANGED
@@ -16,19 +16,19 @@ function main() {
16
16
  logErrorMessage(
17
17
  'Must supply an input file, relative to the workspace root.',
18
18
  );
19
- process.exit();
19
+ process.exit(1);
20
20
  }
21
21
 
22
22
  if (!fs.existsSync(path.join(getRootDir(), input))) {
23
23
  logErrorMessage(`Input file '${input}' does not exist.`);
24
- process.exit();
24
+ process.exit(1);
25
25
  }
26
26
 
27
27
  if (!isPotentialCustomElementName(tag)) {
28
28
  logErrorMessage(
29
29
  `Custom element name '${tag}' is invalid. See https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname`,
30
30
  );
31
- process.exit();
31
+ process.exit(1);
32
32
  }
33
33
 
34
34
  if (buildTarget === 'browser') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixon-cdk/svelte-builder",
3
- "version": "1.1.0-next.2",
3
+ "version": "1.1.0-next.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "",
@@ -17,6 +17,6 @@
17
17
  "vite": "^2.9.5"
18
18
  },
19
19
  "peerDependencies": {
20
- "@ixon-cdk/core": "^1.1.0-next.2"
20
+ "@ixon-cdk/core": "^1.1.0-next.3"
21
21
  }
22
22
  }