diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b995dd4..28afc99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,15 +25,19 @@ jobs: - name: Lint run: pnpm lint + # Build first: packages that import another workspace package (e.g. + # @tronbrowser/sdk -> @tronbrowser/browser-core) resolve it via its built + # dist, so typecheck/test need the dist present. pnpm builds in topological + # order, so dependencies compile before their dependents. + - name: Build + run: pnpm build + - name: Typecheck run: pnpm typecheck - name: Test run: pnpm test - - name: Build - run: pnpm build - # package + release jobs are stubbed until the Chromium build lands in CI. package: runs-on: ubuntu-latest diff --git a/apps/desktop/launcher/tron-run-hooks.mjs b/apps/desktop/launcher/tron-run-hooks.mjs new file mode 100644 index 0000000..66c904d --- /dev/null +++ b/apps/desktop/launcher/tron-run-hooks.mjs @@ -0,0 +1,15 @@ +// ESM resolver hook for `tron run`: maps the bare `@tronbrowser/*` specifiers a +// user script imports to the runtime shipped in the launcher payload, so scripts +// need no node_modules of their own. Registered by tron-run.mjs. +let map = {}; + +export async function initialize(data) { + map = data ?? {}; +} + +export async function resolve(specifier, context, next) { + if (Object.prototype.hasOwnProperty.call(map, specifier)) { + return { url: map[specifier], shortCircuit: true }; + } + return next(specifier, context); +} diff --git a/apps/desktop/launcher/tron-run.mjs b/apps/desktop/launcher/tron-run.mjs new file mode 100644 index 0000000..4111e3e --- /dev/null +++ b/apps/desktop/launcher/tron-run.mjs @@ -0,0 +1,57 @@ +// `tron run