Skip to content

Build on scratch-gui's packaging engine instead of a second copy - #2

Merged
Mistium merged 2 commits into
masterfrom
share-gui-packager-core
Sep 21, 2026
Merged

Mistium merged 2 commits into
masterfrom
share-gui-packager-core

Conversation

@Mistium

@Mistium Mistium commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Needs MistWarp/scratch-gui#22 merged first: CI checks the engine out from
develop, and test/packager/build-id.test.js needs its tolerant
verifyBuildId.

src/scaffolding, src/addons, src/common and most of src/packager were a
second copy of what scratch-gui carries in src/packager — 107 of this repo's
144 source files. They had already drifted apart, and since MistWarp's packager
work lands on the editor's copy, this was the stale one. The editor's copy is
also ahead: browser storage, the account host, the game shop.

What moved and what stayed

Deleted here, read from scratch-gui instead: the scaffolding runtime, the
addons, src/common, and the packager core.

Still this repo's, because it is not the engine:

  • src/p4 — the Svelte interface behind packager.warp.mistium.com
  • src/build — the webpack plumbing, service worker and standalone generator
  • src/packager/node — the @turbowarp/packager Node API
  • src/packager/brand.js — this site calls itself the MistWarp Packager, not
    MistWarp, and packaged projects credit and link to it
  • src/locales — a Svelte store the editor's copy has no equivalent for

The engine is found beside this repository, or wherever SCRATCH_GUI points.
CI checks it out; src/build/engine-path.js says so if it cannot find it.
Nothing of scratch-gui is installed or built — only src/packager is read.

Making webpack 4 read them

  • babel now covers the engine path and .mjs, which rotur-sdk ships.
  • Resolution prefers our node_modules over any node_modules scratch-gui
    happens to have next door, so the engine gets the dependencies this repo
    declares.
  • fake-indexeddb and rotur-sdk are transpiled; they ship class fields, and
    webpack 4 cannot parse those.
  • rotur-sdk and fake-indexeddb are added as dependencies.
  • The build id now hashes the engine rather than the deleted directories, so an
    engine change still invalidates cached runtimes.

Rebased onto master

#4 already gave every config a shared makeJavascriptRule(). The engine and
fake-indexeddb are added to that rule rather than kept as a second one;
rotur-sdk keeps the rule #1 gave it.

Resolving the engine from beside this repository

CI nests the engine inside this repository, so anything it imports walks up to
our node_modules. Beside it — the layout engine-path.js documents — jest
could not find @turbowarp/sbdl and webpack could not find raw-loader. Both
now resolve against our node_modules first, as the webpack resolve config
already did. Jest is also limited to test/; with the engine nested it had been
collecting scratch-gui's 300-odd suites too.

Verified

Against MistWarp/scratch-gui#22, checked out beside this repository:

  • npm run build — website, scaffolding-full.js, scaffolding-min.js,
    addons.js and the extension workers all emitted.
  • npm run build-standalone-prod — dist/standalone.html.
  • npm test — 16 suites, 48 passed, 1 skipped.

Branding held: MistWarp Packager, packager.warp.mistium.com and #d499e6
are all still in the built output, and relativeScaffolding still resolves to
scaffolding/… rather than the editor's build-id directory.

One test caught a real difference. The editor's verifyBuildId rejects a
runtime with no build id stamped on it; this repo only stamps one in production,
so that would make a development build refuse the scaffolding it just wrote.
MistWarp/scratch-gui#22 restores the tolerant check.

Note

README.md is currently the Node API readme — prepublishOnly swaps it in and
postpublish never put the original back. Left alone here, but it means there
is nowhere obvious documenting the scratch-gui checkout; the error message from
engine-path.js carries it instead.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Deploying packagermistwarp with  Cloudflare Pages  Cloudflare Pages

Latest commit: bc5fe6d
Status: ✅  Deploy successful!
Preview URL: https://1566ef21.packagermistwarp.pages.dev
Branch Preview URL: https://share-gui-packager-core.packagermistwarp.pages.dev

View logs

@Mistium
Mistium added this pull request to stack #3 September 21, 2026 01:11
@Mistium
Mistium removed this pull request from stack #3 September 21, 2026 01:28
@Mistium
Mistium changed the base branch from mistwarp-forks to master September 21, 2026 01:28
Mistium and others added 2 commits September 21, 2026 03:22
src/scaffolding, src/addons, src/common and most of src/packager were a second
copy of what scratch-gui carries in src/packager. The two had already drifted,
and MistWarp's packager work lands on the editor's copy, so this one was the
stale one.

Delete it and build from scratch-gui's, checked out beside this repository or
found through SCRATCH_GUI. What stays is what is genuinely this repo's: the p4
interface, the webpack build, the Node API, its branding and its Svelte
translations. The engine asks its host for a runtime URL and for branding
through virtual:packager-runtime, so packaged projects still say MistWarp
Packager and link to packager.warp.mistium.com.

Three things had to change to make webpack 4 read those sources: babel now
covers the engine and .mjs files, resolution prefers our node_modules over any
node_modules scratch-gui happens to have, and fake-indexeddb and rotur-sdk get
transpiled because they ship class fields.

The website and Node bundles had no babel pass at all, which is why
`npm run build` has failed since 86e2e5d added nullish coalescing to
packager.js. They have one now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI checks scratch-gui out inside this repository, so jest collected its
300-odd suites along with ours. Limit it to test/.

Engine sources resolved imports and inline loaders by walking up from
their own directory. That only reaches our node_modules when the engine
is nested inside this repository, as in CI; checked out beside it, as
engine-path.js documents, jest could not find @turbowarp/sbdl and webpack
could not find raw-loader. Resolve both against our node_modules first,
as the webpack resolve config already does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Mistium
Mistium force-pushed the share-gui-packager-core branch from 29a2c39 to bc5fe6d Compare September 21, 2026 02:26
@Mistium
Mistium merged commit 3143448 into master Sep 21, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant