diff --git a/tools/slintpad/package.json b/tools/slintpad/package.json index 75cd10b2546..f6c971ff702 100644 --- a/tools/slintpad/package.json +++ b/tools/slintpad/package.json @@ -1,5 +1,5 @@ { - "//": "cSpell: ignore lumino dragdrop frsource ", + "//": "cSpell: ignore codingame dragdrop frsource lumino ", "name": "slintpad", "version": "1.0.3", "description": "", @@ -19,7 +19,8 @@ "test:cypress_run-chromium": "cypress run --browser=chromium --e2e", "test:cypress_open-chromium": "cypress open --browser=chromium --e2e", "test:cypress_run-ff": "cypress run --browser=firefox --e2e", - "test:cypress_open-ff": "cypress open --browser=firefox --e2e" + "test:cypress_open-ff": "cypress open --browser=firefox --e2e", + "slintpad:prepublish": "npm run build:wasm_lsp-release && npm run build:wasm_preview-release" }, "keywords": [], "author": "", diff --git a/tools/slintpad/src/editor_widget.ts b/tools/slintpad/src/editor_widget.ts index 7c93caa45e2..9683be817a2 100644 --- a/tools/slintpad/src/editor_widget.ts +++ b/tools/slintpad/src/editor_widget.ts @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -// cSpell: ignore lumino inmemory mimetypes printerdemo +// cSpell: ignore edcore lumino inmemory mimetypes printerdemo // import "monaco-editor/esm/vs/editor/edcore.main.js"; import * as monaco from "monaco-editor/esm/vs/editor/editor.api"; @@ -849,7 +849,8 @@ export class EditorWidget extends Widget { async set_demo(location: string) { if (location) { - let tag = "master"; + const default_tag = "XXXX_DEFAULT_TAG_XXXX"; + let tag = default_tag.startsWith("XXXX_DEFAULT_TAG_") ? "master" : default_tag; { let found; if ( diff --git a/tools/slintpad/vite.config.ts b/tools/slintpad/vite.config.ts index 4474e73b594..9da01fe31a3 100644 --- a/tools/slintpad/vite.config.ts +++ b/tools/slintpad/vite.config.ts @@ -1,15 +1,12 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -// TODO: Do build and package wasm-lsp separately. Right now vite does not -// support `exclude` in web workers! - -// cSpell: ignore iife lumino +// cSpell: ignore lumino import { defineConfig, UserConfig } from "vite"; import { VitePWA } from "vite-plugin-pwa"; -export default defineConfig(({ command }) => { +export default defineConfig(() => { const base_config: UserConfig = { server: { fs: { @@ -28,7 +25,14 @@ export default defineConfig(({ command }) => { }, }, }, - resolve: {}, + resolve: { + alias: { + "@lsp/": "../../../lsp/pkg/", + "@preview/": "../../../api/wasm-interpreter/pkg/", + "~@lumino": "node_modules/@lumino/", // work around strange defaults in @lumino + path: "path-browserify", // To make path.sep available to monaco + }, + }, plugins: [ VitePWA({ registerType: "autoUpdate", @@ -50,41 +54,5 @@ export default defineConfig(({ command }) => { ], }; - const global_aliases = { - "@lsp/": "../../../lsp/pkg/", - "~@lumino": "node_modules/@lumino/", // work around strange defaults in @lumino - path: "path-browserify", // To make path.sep available to monaco - }; - - if (command === "serve") { - // For development builds, serve the wasm interpreter straight out of the local file system. - base_config.resolve = { - alias: { - "@preview/": "../../../api/wasm-interpreter/pkg/", - ...global_aliases, - }, - }; - } else { - // For distribution builds, - // assume deployment on the main website where the loading file (index.js) is in the assets/ - // sub-directory and the relative path to the interpreter is as below. - if (base_config.build == null) { - base_config.build = {}; - } - base_config.build.rollupOptions = { - makeAbsoluteExternalsRelative: true, - external: [ - "../../../../wasm-interpreter/slint_wasm_interpreter.js", - ], - ...base_config.build.rollupOptions, - }; - base_config.resolve = { - alias: { - "@preview/": "../../../../wasm-interpreter/", - ...global_aliases, - }, - }; - } - return base_config as UserConfig; });