@symbiote-native/vue 3.4.0 → 3.5.0

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.
@@ -134,7 +134,8 @@ function trimReflowedTextNodeTransform(node) {
134
134
  }
135
135
  }
136
136
 
137
- const SYMBIOTE_SOURCE_PREFIX = '@symbiote-native/';
137
+ // The scope of this package's own name, `@symbiote-native/`, so the prefix has one source
138
+ const SYMBIOTE_SOURCE_PREFIX = `${require('./package.json').name.split('/')[0]}/`;
138
139
 
139
140
  // Local names the file imports from any `@symbiote-native/*` package (`FlatList`, `Animated`)
140
141
  function symbioteImportsOf(descriptor) {
@@ -251,12 +252,19 @@ function parseDescriptor(src, filename) {
251
252
  `Vue SFC parse error in ${filename}:\n${errors.map(String).join('\n')}`,
252
253
  );
253
254
  }
254
- if (descriptor.scriptSetup == null && descriptor.script == null) {
255
- throw new Error(
256
- `Vue SFC ${filename} has no <script> / <script setup> block`,
257
- );
255
+ if (descriptor.scriptSetup != null || descriptor.script != null) {
256
+ return descriptor;
257
+ }
258
+ if (descriptor.template == null) {
259
+ throw new Error(`Vue SFC ${filename} has no <template> / <script> block`);
258
260
  }
259
- return descriptor;
261
+ // `compileScript` refuses a file without a script, yet a static template is a valid component
262
+ // A `<script setup>` appended after the source keeps every line number of the file
263
+ // It carries a comment since the parser drops a blank block, which would recurse forever
264
+ return parseDescriptor(
265
+ `${src}\n<script setup>/* static template */</script>\n`,
266
+ filename,
267
+ );
260
268
  }
261
269
 
262
270
  // `<style scoped>` and `<style module>` are one mechanism, lightningcss' CSS-Modules renaming
@@ -271,11 +279,10 @@ function compileSfcStyleBlock({ style, content, filename, scopeId }) {
271
279
  return { rules: compiled.rules, binding: [bindingName, compiled.classMap] };
272
280
  }
273
281
  if (style.scoped) {
274
- const compiled = compileScopedCss(content, {
282
+ return compileScopedCss(content, {
275
283
  filename,
276
284
  pattern: `[local]__${scopeId}`,
277
285
  });
278
- return { rules: compiled.rules, names: compiled.names };
279
286
  }
280
287
  return { rules: compileCssToRules(content, { filename }).rules };
281
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/vue",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "SymbioteNative's Vue adapter — a @vue/runtime-core createRenderer driving real native iOS/Android views through the same engine as the React adapter.",
5
5
  "license": "MIT",
6
6
  "repository": {