@dosgato/dialog 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@
39
39
  { indentOnInput },
40
40
  { javascript },
41
41
  { tsFacet, tsSync, tsHover },
42
- ts,
42
+ tsModule,
43
43
  { createDefaultMapFromCDN, createSystem, createVirtualTypeScriptEnvironment }
44
44
  ] = await Promise.all([
45
45
  import('codemirror'),
@@ -52,6 +52,7 @@
52
52
  import('typescript'),
53
53
  import('@typescript/vfs')
54
54
  ])
55
+ const ts = tsModule.default ?? tsModule
55
56
 
56
57
  const compilerOptions: CompilerOptions = {
57
58
  target: ts.ScriptTarget.ES2024,
@@ -145,7 +146,12 @@
145
146
  parent: editorelement
146
147
  })
147
148
  updatePreamble = (text: string) => {
148
- env.updateFile(PREAMBLE_PATH, text)
149
+ const content = text || ' '
150
+ if (env.getSourceFile(PREAMBLE_PATH)) {
151
+ env.updateFile(PREAMBLE_PATH, content)
152
+ } else {
153
+ env.createFile(PREAMBLE_PATH, content)
154
+ }
149
155
  }
150
156
  updateCode = code => {
151
157
  if (editor.state.doc.toString() !== code) editor.update([editor.state.update({ changes: { from: 0, to: editor.state.doc.length, insert: code } })])
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dosgato/dialog",
3
3
  "description": "A component library for building forms that edit a JSON document.",
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",