@soleil-se/build-app 2.2.1 → 2.3.1

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ title: Changelog
4
4
 
5
5
  Baseras på [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) och använder [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.3.1] - 2025-05-26
8
+
9
+ - Ta bort hydration markers för en app som renderas på servern, då det inte är nödvändigt.
10
+
11
+ ## [2.3.0] - 2025-04-16
12
+
13
+ - Lägg till nytt argument för att kunna ange yttertligare sökväg för watchern, `--append-watch-path`.
14
+
7
15
  ## [2.2.1] - 2025-04-09
8
16
 
9
17
  - Ta bort encoding av lösenord vid anrop.
package/index.js CHANGED
@@ -13,6 +13,16 @@ import { client, server } from './rollup/index.js';
13
13
  import { activate, upload, sign } from './requests/index.js';
14
14
  import config from './config/index.js';
15
15
 
16
+ function getWatchOptions() {
17
+ const appendPath = args['append-watch-path'];
18
+ const defaultIgnored = ['dist', 'node_modules', '*.md', '.*', 'package-lock.json', 'yarn.lock', '*config*.*'];
19
+ const ignored = appendPath
20
+ ? defaultIgnored.map((ignore) => `${appendPath}/${ignore}`).concat(defaultIgnored)
21
+ : defaultIgnored;
22
+ const paths = appendPath ? ['.', appendPath] : ['.'];
23
+ return { paths, ignored };
24
+ }
25
+
16
26
  async function main() {
17
27
  const manifest = await readManifest();
18
28
  const zipPath = `./dist/${manifest.id}-${manifest.version}.zip`;
@@ -93,9 +103,10 @@ async function main() {
93
103
  }
94
104
 
95
105
  if (args.watch) {
96
- watch('.', () => runTasks(tasks), {
106
+ const { paths, ignored } = getWatchOptions(args);
107
+ watch(paths, () => runTasks(tasks), {
97
108
  message: 'Watching for changes...',
98
- ignored: ['dist', 'node_modules', '*.md', '.*', 'package-lock.json', 'yarn.lock', '*config*.*'],
109
+ ignored,
99
110
  });
100
111
  if (!args.project) createChecksumChecker();
101
112
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soleil-se/build-app",
3
3
  "description": "Script for building WebApps, RESTApps and Widgets with Svelte in Sitevision.",
4
- "version": "2.2.1",
4
+ "version": "2.3.1",
5
5
  "bin": {
6
6
  "build-app": "./bin/index.js",
7
7
  "sv-app-build": "./bin/index.js"
@@ -53,7 +53,7 @@
53
53
  "slash": "5.1.0",
54
54
  "svelte-preprocess": "6.0.3",
55
55
  "@soleil-se/build-config": "^1.3.0",
56
- "@soleil-se/build-utils": "^1.8.2"
56
+ "@soleil-se/build-utils": "^1.8.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "svelte": "^5.6.2"
package/utils/files.js CHANGED
@@ -6,9 +6,21 @@ const indexContent = `(function() {
6
6
  router.get('/', function() {});
7
7
  }());`;
8
8
 
9
+ /**
10
+ * Remove Svelte 5 hydration markers (<!---->, <!--]-->, <!--[-->) from the source file when they
11
+ * aren't needed, for example in SSR.
12
+ * @param {string} src - The path to the source file.
13
+ * @returns {Promise<void>}
14
+ */
15
+ async function removeHydrationMarkers(src) {
16
+ const content = await fse.readFile(src);
17
+ await fse.writeFile(src, content.toString().replace(/(\\x3c!----\\x3e|\\x3c!--\[--\\x3e|\\x3c!--]--\\x3e)/gm, ''));
18
+ }
19
+
9
20
  async function createMain(dest) {
10
21
  const src = `${dest}/src/main.js`;
11
22
  if (!fse.existsSync(src)) {
23
+ await removeHydrationMarkers(`${dest}/src/index.js`);
12
24
  await fse.writeFile(src, '');
13
25
  }
14
26
  }