@soleil-se/build-app 1.0.2 → 1.1.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/build-app",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "bin": {
5
5
  "build-app": "./bin/index.js",
6
6
  "sv-app-build": "./bin/index.js"
@@ -14,29 +14,29 @@
14
14
  },
15
15
  "homepage": "https://docs.soleil.se/build/app",
16
16
  "dependencies": {
17
- "@babel/core": "7.16.12",
17
+ "@babel/core": "7.17.3",
18
18
  "@babel/preset-env": "7.16.11",
19
19
  "@rollup/plugin-alias": "3.1.9",
20
20
  "@rollup/plugin-babel": "5.3.0",
21
21
  "@rollup/plugin-commonjs": "21.0.1",
22
22
  "@rollup/plugin-json": "4.1.0",
23
23
  "@rollup/plugin-node-resolve": "13.1.3",
24
- "@rollup/plugin-replace": "3.0.1",
24
+ "@rollup/plugin-replace": "3.1.0",
25
25
  "@soleil-se/build-config": "1.1.1",
26
26
  "@soleil-se/build-utils": "1.3.0",
27
27
  "archiver": "5.3.0",
28
28
  "autoprefixer": "^10.4.2",
29
29
  "babel-plugin-transform-async-to-promises": "^0.8.18",
30
30
  "chalk": "5.0.0",
31
- "find-up": "6.2.0",
31
+ "find-up": "6.3.0",
32
32
  "form-data": "4.0.0",
33
33
  "fs-extra": "10.0.0",
34
34
  "got": "12.0.1",
35
35
  "lodash-es": "4.17.21",
36
36
  "postcss": "8.4.6",
37
- "postcss-discard-duplicates": "^5.0.2",
37
+ "postcss-discard-duplicates": "^5.0.3",
38
38
  "postcss-pxtorem": "^6.0.0",
39
- "rollup": "2.66.1",
39
+ "rollup": "2.67.2",
40
40
  "rollup-plugin-cleanup": "3.2.1",
41
41
  "rollup-plugin-filesize": "9.1.2",
42
42
  "rollup-plugin-insert": "^1.3.2",
@@ -45,10 +45,10 @@
45
45
  "rollup-plugin-svelte": "7.1.0",
46
46
  "rollup-plugin-terser": "7.0.2",
47
47
  "slash": "4.0.0",
48
- "svelte-preprocess": "4.10.2"
48
+ "svelte-preprocess": "4.10.3"
49
49
  },
50
50
  "devDependencies": {
51
- "svelte": "3.46.3"
51
+ "svelte": "3.46.4"
52
52
  },
53
53
  "description": "Script for building WebApps, RESTApps and Widgets with Svelte in Sitevision.",
54
54
  "keywords": [
@@ -5,9 +5,6 @@ import { kebabCase } from 'lodash-es';
5
5
 
6
6
  import preprocessOptions from './common/preprocessOptions.js';
7
7
 
8
- let svelte;
9
- let sveltePreprocess;
10
-
11
8
  const validClassRegex = /[^a-z0-9\-_]|^[^a-z]+/gi;
12
9
 
13
10
  const hasSvelte = (input) => {
@@ -22,15 +19,23 @@ const cssHash = ({ hash, css, name }) => {
22
19
  return `${kebabCase(validClass)}-${hash(css)}`;
23
20
  };
24
21
 
22
+ const getPreprocess = async () => {
23
+ const svelteConfigPath = findUpSync('svelte.config.js');
24
+ if (svelteConfigPath) {
25
+ return import(`file://${svelteConfigPath}`).then((pkg) => pkg.default.preprocess);
26
+ }
27
+ const sveltePreprocess = await import('svelte-preprocess').then((pkg) => pkg.default);
28
+ return sveltePreprocess(preprocessOptions);
29
+ };
30
+
25
31
  export default async function getSveltePlugin({
26
32
  input, debug = false, emitCss = true, ssr, hydratable = true,
27
33
  }) {
28
34
  if (hasSvelte(input)) {
29
- svelte = svelte || await import('rollup-plugin-svelte').then((pkg) => pkg.default);
30
- sveltePreprocess = sveltePreprocess || await import('svelte-preprocess').then((pkg) => pkg.default);
35
+ const svelte = await import('rollup-plugin-svelte').then((pkg) => pkg.default);
31
36
 
32
37
  return svelte({
33
- preprocess: sveltePreprocess(preprocessOptions),
38
+ preprocess: await getPreprocess(),
34
39
  emitCss,
35
40
  compilerOptions: {
36
41
  generate: ssr ? 'ssr' : 'dom',