Skip to content

Expose ensureTable on plugin scope#743

Open
Baijack-star wants to merge 1 commit into
HarperFast:mainfrom
Baijack-star:expose-scope-ensuretable
Open

Expose ensureTable on plugin scope#743
Baijack-star wants to merge 1 commit into
HarperFast:mainfrom
Baijack-star:expose-scope-ensuretable

Conversation

@Baijack-star
Copy link
Copy Markdown

Summary

  • add scope.ensureTable(options) for the new handleApplication(scope) plugin API
  • preserve the legacy ensureTable behavior of stamping the component origin before delegating to table(options)
  • pass the loader's origin into Scope and cover it with a component-loader unit test

Why

Issue #607 notes that plugins migrating from the old start / startOnMainThread API lose access to the legacy ensureTable helper. The old helper did:

options.origin = origin;
return table(options);

This keeps that same behavior available from handleApplication(scope) as scope.ensureTable(options).

Verification

  • npm_config_cache=/tmp/npm-cache-harper-ensuretable npm ci --ignore-scripts
  • npm run build
  • node --expose-internals --enable-source-maps --experimental-vm-modules - <<'NODE' ... NODE running unitTests/components/componentLoader.test.js with grep /ensureTable/ after initTestEnvironment()
  • npm run lint:required -- components/Scope.ts components/componentLoader.ts unitTests/components/componentLoader.test.js
  • git diff --check

Note: running ./node_modules/.bin/mocha unitTests/components/componentLoader.test.js --grep ensureTable directly failed before the test loaded because the component loader imports modules that expect the unit-test environment to be initialized. The programmatic Mocha run initializes environmentManager.initTestEnvironment() first and the new test passes.

I used an AI coding assistant to prepare this patch.

Fixes #607

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.

Expose ensureTable on Scope for handleApplication (plugin API parity)

3 participants