Skip to content

build: add reproducible VSIX package command - #957

Merged
lcottercertinia merged 19 commits into
certinia:mainfrom
forcedotcom:feat-vsix-build-upstream
Sep 2, 2026
Merged

build: add reproducible VSIX package command#957
lcottercertinia merged 19 commits into
certinia:mainfrom
forcedotcom:feat-vsix-build-upstream

Conversation

@peternhale

Copy link
Copy Markdown
Contributor

PR overview

Stack 5 of 5. Depends on #954. Adds a repository-local command for reproducible VSIX packaging.

Changes made

  • Add a lana-scoped build:vsix command.
  • Pin @vscode/vsce as a local development dependency.
  • Document the repository-local packaging workflow.

Type of change

  • Build
  • Documentation

Validation

  • pnpm --filter lana run build:vsix
  • Verified lana/lana-1.20.1.vsix contains both extension entrypoints and all webview runtime assets

@peternhale
peternhale force-pushed the feat-vsix-build-upstream branch from aa080a5 to d5cf667 Compare September 1, 2026 18:19
@peternhale

Copy link
Copy Markdown
Contributor Author

@lukecotter I made the module for browser CJS in this PR.

…2e-upstream

# Conflicts:
#	.gitignore
#	lana/package.json
#	lana/src/__tests__/mocks/vscode.ts
#	lana/src/cache/LogEventCache.ts
#	lana/src/cache/__tests__/LogEventCache.test.ts
#	lana/src/commands/LogView.ts
#	lana/src/commands/RetrieveLogFile.ts
#	lana/src/commands/ShowLogAnalysis.ts
#	lana/src/commands/__tests__/RetrieveLogFile.test.ts
#	lana/src/folding/RawLogFoldingProvider.ts
#	lana/src/folding/__tests__/RawLogFoldingProvider.test.ts
#	lana/src/hovers/RawLogHoverProvider.ts
#	lana/src/language/ApexLogLanguageDetector.ts
#	lana/src/log-features/RawLogNavigation.ts
#	lana/src/services/salesforceServices.ts
#	lana/src/services/servicesRuntime.ts
#	lana/src/symbols/RawLogSymbolProvider.ts
#	lana/tsconfig.json
#	pnpm-lock.yaml
#	rollup.config.mjs
…into feat-vsix-build-upstream

# Conflicts:
#	lana/package.json
#	lana/test/playwright/support/paths.ts
#	pnpm-lock.yaml
#	rolldown.config.ts
…tream

# Conflicts:
#	.github/workflows/ci.yml
#	lana/test/playwright/support/logAnalysis.ts
#	lana/test/playwright/support/logWorkspace.ts
#	lana/test/playwright/support/paths.ts
#	pnpm-lock.yaml
@lcottercertinia
lcottercertinia merged commit 0289974 into certinia:main Sep 2, 2026
8 checks passed
lcottercertinia pushed a commit that referenced this pull request Sep 3, 2026
# PR overview

Follow-up to #953 and #957. `Log: Retrieve Apex Log And Show Analysis`
cannot work in the web
extension host, because the web bundle is split across two files.

## The problem

The web extension host does not use Node's loader. It fetches the entry
point as text and wraps
it:

```js
initFn = new Function('module', 'exports', 'require', fullSource);
```

The `require` it supplies resolves only `'vscode'`. `importScripts` is
blocked, and `require`
and `define` are set to `undefined` in the worker. The docs say it
plainly: "Importing or
requiring other modules is not supported... the code must be packaged to
a single file."

Both web builds emitted two files:

```
lana/out/web/
  Main.web.cjs
  lana-salesforceServices.js
```

`RetrieveLogFile.ts:56` does `await
import('../services/salesforceServices.js')`, which rollup
lowers to `require("./lana-salesforceServices.js")`. That require throws
in the web host.

It sits in the lazy path near the end of the file, not at the top, so
the extension still
activates and only Retrieve is affected.

## Changes made

- `rollup.config.mjs`: `inlineDynamicImports: true` on the web output.
- `rolldown.config.ts`: `codeSplitting: false` on the web output.
Rolldown deprecates
  `inlineDynamicImports` in favour of this name, hence the difference.
- Drop `chunkFileNames` from both, now that neither emits a chunk.

## Type of change

- [x] Bug fix

## Validation

Built both paths, production mode:

| | before | after |
|---|---|---|
| rollup `lana/out/web/` | 2 files | **1 file**, `Main.web.cjs`, 806,071
bytes |
| rolldown `lana/out/web/` | 2 files | **1 file**, `Main.web.cjs` |
| requires in the entry | `require("vscode")` +
`require("./lana-salesforceServices.js")` | **`require("vscode")` only**
|

The desktop entry is unchanged and still ESM.

Not validated: I have not run this in a live web host, so the fix is
verified against the
emitted bundle and the documented loader, not observed. The web e2e in
CI exercises
`Log: Show Apex Log Analysis`, not Retrieve, so it will not catch this
either way.

## Related

Considered and rejected in the same area: dropping `nodePolyfills()`
from the web target. The
build succeeds without it, but 11 `process.` references survive, and
while most are guarded by
`typeof process`, `path.resolve()`'s shim calls a bare `process.cwd()`.
Removing the plugin
would turn a working shim into a latent `ReferenceError`, so it stays.
lukecotter added a commit to lukecotter/debug-log-analyzer that referenced this pull request Sep 3, 2026
All three workflows installed vsce globally at run time, so the published VSIX
was built with whatever version was latest that day. The @vscode/vsce devDep
that certinia#957 pinned in lana was reachable only from build:vsix, which nothing in
CI called.

ci.yml and publish.yml now run that same script. cd-prerelease.yml needs
--pre-release, so it calls the pinned binary directly.
lukecotter added a commit to lukecotter/debug-log-analyzer that referenced this pull request Sep 3, 2026
All three workflows installed vsce globally at run time, so the published VSIX
was built with whatever version was latest that day. The @vscode/vsce devDep
that certinia#957 pinned in lana was reachable only from build:vsix, which nothing in
CI called.

ci.yml and publish.yml now run that same script. cd-prerelease.yml needs
--pre-release, so it calls the pinned binary directly.
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.

2 participants