Skip to content

Conversation

@sxzz
Copy link
Member

@sxzz sxzz commented Jan 12, 2024

  • Separate import map and store as two functions
    • useStore: keep most of the functionality, and refactor to composables
    • useVueImportMap: extract links of the Vue import map.

@vercel
Copy link

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
repl ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2024 10:50am

tsVersion: store.state.typescriptVersion,
tsLocale: store.state.typescriptLocale || store.state.locale,
tsVersion: store.typescriptVersion,
tsLocale: store.locale,
Copy link
Member Author

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()
Copy link
Member Author

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
Copy link
Member Author

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]
Copy link
Member Author

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,
Copy link
Member Author

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,
Copy link
Member Author

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> = {},
Copy link
Member Author

@sxzz sxzz Jan 12, 2024

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

Comment on lines -62 to -76
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
},
}
})
Copy link
Member Author

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
Copy link
Member Author

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.

@sxzz sxzz mentioned this pull request Jan 14, 2024
@sxzz sxzz merged commit d01bf55 into main Jan 21, 2024
@sxzz sxzz deleted the refactor/use-store branch January 21, 2024 08:26
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