-
Notifications
You must be signed in to change notification settings - Fork 217
refactor!: useStore & useVueImportMap composable #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
281cd65 to
e043ad1
Compare
| tsVersion: store.state.typescriptVersion, | ||
| tsLocale: store.state.typescriptLocale || store.state.locale, | ||
| tsVersion: store.typescriptVersion, | ||
| tsLocale: store.locale, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: remove typescriptLocale, since it's already marked as deprecated.
| imports.vue = runtimeUrl | ||
| imports['vue/server-renderer'] = ssrUrl | ||
| this.setImportMap(importMap) | ||
| this.forceSandboxReset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed resetFlip flag. I tested vuejs/docs#1973 issue on Safari and works now.
I guess this issue is resolved, since sandbox will be re-created after import map is updated
| showImportMap?: boolean | ||
| showTsConfig?: boolean | ||
| clearConsole?: boolean | ||
| sfcOptions?: SFCOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: remove sfcOptions on component but moved to Store
| for (const filename in store.state.files) { | ||
| const file = store.state.files[filename] | ||
| for (const filename in store.files) { | ||
| const file = store.files[filename] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: remove state property and merged top level of Store
| const { errors, descriptor } = store.compiler.parse(code, { | ||
| filename, | ||
| sourceMap: true, | ||
| templateParseOptions: store.options?.template?.compilerOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: rename options to sfcOptions
| dependencyVersion = ref(Object.create(null)), | ||
| reloadLanguageTools = ref(), | ||
| }: Partial<StoreState> = {}, | ||
| serializedState?: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move serializedState as the second argument.
| typescriptVersion = ref('latest'), | ||
| dependencyVersion = ref(Object.create(null)), | ||
| reloadLanguageTools = ref(), | ||
| }: Partial<StoreState> = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed StoreOptions and merged to StoreState
| watchEffect(() => { | ||
| const { store } = props | ||
| const sfcOptions = (store.options = props.sfcOptions || {}) | ||
| sfcOptions.script ||= {} | ||
| sfcOptions.script.fs = { | ||
| fileExists(file: string) { | ||
| if (file.startsWith('/')) file = file.slice(1) | ||
| return !!store.state.files[file] | ||
| }, | ||
| readFile(file: string) { | ||
| if (file.startsWith('/')) file = file.slice(1) | ||
| return store.state.files[file].code | ||
| }, | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to store
| } | ||
|
|
||
| // styles | ||
| const ceFilter = store.customElement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed customElement option, now get it from sfcOptions.script.customElement.
f19cefa to
5f61884
Compare
useStore: keep most of the functionality, and refactor to composablesuseVueImportMap: extract links of the Vue import map.