From d62ab13a35c756ea567c426d4fbe00d893dd7e2b Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Mon, 14 Sep 2026 06:02:13 +0800 Subject: [PATCH] feat(vue): [EX-02] verify installed consumers and preserve lifecycle contracts --- .github/workflows/nodejs.yml | 3 + example/vue.js/README.md | 89 +- example/vue.js/eslint.config.js | 2 + example/vue.js/index.html | 10 +- example/vue.js/jsconfig.json | 8 - example/vue.js/package.json | 17 +- example/vue.js/src/App.vue | 8 +- example/vue.js/src/Player.vue | 40 +- example/vue.js/src/{main.js => main.ts} | 0 example/vue.js/src/player-options.ts | 23 + example/vue.js/tsconfig.json | 18 + example/vue.js/vite.config.js | 2 - package.json | 12 +- .../baselines/vue-consumer-validation.json | 1519 +++++++++++++++++ .../changes/2026-09-14-EX-02-vue-consumer.md | 105 ++ refactor/ci-setup.md | 2 + refactor/plan.md | 5 +- refactor/progress.md | 16 + refactor/scripts/ci-workflow.mjs | 3 + refactor/scripts/ci-workflow.test.mjs | 3 + refactor/scripts/vue-consumer.mjs | 254 +++ refactor/tasks.json | 11 +- test/README.md | 9 + test/vue/LegacyConsumer.vue | 20 + test/vue/Lifecycle.vue | 99 ++ test/vue/consumer.ts | 18 + test/vue/entry.ts | 6 + test/vue/legacy-entry.js | 4 + yarn.lock | 102 +- 29 files changed, 2326 insertions(+), 82 deletions(-) create mode 100644 example/vue.js/eslint.config.js delete mode 100644 example/vue.js/jsconfig.json rename example/vue.js/src/{main.js => main.ts} (100%) create mode 100644 example/vue.js/src/player-options.ts create mode 100644 example/vue.js/tsconfig.json create mode 100644 refactor/baselines/vue-consumer-validation.json create mode 100644 refactor/changes/2026-09-14-EX-02-vue-consumer.md create mode 100644 refactor/scripts/vue-consumer.mjs create mode 100644 test/vue/LegacyConsumer.vue create mode 100644 test/vue/Lifecycle.vue create mode 100644 test/vue/consumer.ts create mode 100644 test/vue/entry.ts create mode 100644 test/vue/legacy-entry.js diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 850e98451..8ba73f8ba 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -133,6 +133,8 @@ jobs: run: node scripts/package-runtime.mjs --canonical 2>&1 | tee refactor/.cache/ci/consumer-node-canonical.log - name: Verify React installed consumers run: yarn test:react-consumer 2>&1 | tee refactor/.cache/ci/react-consumer.log + - name: Verify Vue installed consumers + run: yarn test:vue-consumer 2>&1 | tee refactor/.cache/ci/vue-consumer.log - name: Run all three engines run: yarn test:browser 2>&1 | tee refactor/.cache/ci/browser.log - name: Verify iframe cached history and interrupted navigation @@ -149,6 +151,7 @@ jobs: refactor/.cache/browser/ refactor/.cache/iframe-history/ refactor/.cache/react-consumer-*/ + refactor/.cache/vue-consumer-*/ refactor/.cache/performance/ refactor/.cache/packages/latest.json refactor/.cache/packages/run-*/*.json diff --git a/example/vue.js/README.md b/example/vue.js/README.md index bf72983ef..ecccd11bd 100644 --- a/example/vue.js/README.md +++ b/example/vue.js/README.md @@ -1,29 +1,76 @@ -# vue-project +# Vue consumer example -This template should help get you started developing with Vue 3 in Vite. - -## Recommended IDE Setup - -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). - -## Customize configuration - -See [Vite Configuration Reference](https://vite.dev/config/). - -## Project Setup +Run the example from the repository root with Node from .node-version and Yarn +Classic 1.22.22. Use yarn install --frozen-lockfile and only the root yarn.lock. ```sh -npm install +yarn dev:vue +yarn typecheck:vue +yarn lint:vue +yarn build:vue +yarn test:vue-consumer ``` -### Compile and Hot-Reload for Development +The build output is refactor/.cache/vue-example-dist. +Rebuild changed library distributions with yarn build followed by the package name. -```sh -npm run dev -``` +## Files and ownership -### Compile and Minify for Production +- src/Player.vue owns the player and container through shallow refs. It constructs + once on mount, emits getInstance, then releases its reference before calling + destroy(false) on owner unmount. Vue owns the outer div. Player state is private: + the component ref exposes the normal Vue surface, not an art property. +- src/player-options.ts holds this example's existing configuration overrides: + French language, French/Indonesian dictionaries and fresh Danmuku/Document PiP + factories per mount. They still override option.lang, i18n and plugins. The + container comes from Vue; other options pass through. The url assertion preserves + the historical Partial input while the core performs runtime validation. +- src/App.vue demonstrates the existing event/prop syntax. Its reactive option + object keeps narrow field inference and is checked against `Partial