@bakery-framework/plugin-vue 2.4.0 → 2.5.0-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakery-framework/plugin-vue",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-alpha.0",
4
4
  "description": "Bakery vue plugin.",
5
5
  "keywords": [
6
6
  "bakery",
@@ -43,7 +43,7 @@
43
43
  "vue": "^3.5.38"
44
44
  },
45
45
  "dependencies": {
46
- "@bakery-framework/core": "^2.4.0"
46
+ "@bakery-framework/core": "^2.5.0-alpha.0"
47
47
  },
48
48
  "engines": {
49
49
  "bun": ">=1.4.0"
package/src/built.ts CHANGED
@@ -205,8 +205,3 @@ export async function builtPage(
205
205
  const build = await loadBuild()
206
206
  return build?.manifest.roots[fs.resolve(root)]?.[fs.resolve(file)] ?? null
207
207
  }
208
-
209
- /** Test seam (convention 9): forget the memoized build. */
210
- export function __resetBuild(): void {
211
- loaded = null
212
- }
package/src/compile.ts CHANGED
@@ -126,7 +126,7 @@ export async function parseVue(
126
126
  }
127
127
  }
128
128
 
129
- export async function compileScriptBlock(
129
+ async function compileScriptBlock(
130
130
  options: CompileScriptOptions,
131
131
  ): Promise<CompileScriptResult> {
132
132
  const { descriptor, id } = options
package/src/handler.ts CHANGED
@@ -423,7 +423,6 @@ export class VueHandler extends DynamicHandler {
423
423
  return servedAsAsset.has(req)
424
424
  }
425
425
 
426
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: SFC parser
427
426
  static async parseVueFile(
428
427
  id: string,
429
428
  diskFile: Bun.BunFile,
@@ -809,7 +808,6 @@ async function serveIfDirect(value: any, req: Request) {
809
808
  return (await ETag.sendFile(direct, req)) || new Response(direct as any)
810
809
  }
811
810
 
812
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: request handler, one branch per SFC render path
813
811
  /**
814
812
  * Requests `sharedHandler` answered with an asset, for `VueHandler.isAsset`.
815
813
  * Weak, so an entry lives exactly as long as its request. Recorded by the
package/src/utils.ts CHANGED
@@ -29,15 +29,15 @@ export function initVueVersion() {
29
29
  return VUE_VERSION
30
30
  }
31
31
 
32
- export const RX_IMPORT_VUE_FILE =
32
+ const RX_IMPORT_VUE_FILE =
33
33
  /(?:from\s+|import\s+|import\()(['"][^'"]*\.vue['"])/g
34
34
  export const RX_EXPORT_BRACE = /\bexport\s*\{([\s\S]*?)\}/g
35
35
  export const RX_EXPORT_HANGING = /\bexport\s+(const|let|var)\s+(\w+)\s*=\s*/g
36
- export const RX_EXPORT_FUNCTION = /\bexport\s+(?:async\s+)?function\s+(\w+)/g
36
+ const RX_EXPORT_FUNCTION = /\bexport\s+(?:async\s+)?function\s+(\w+)/g
37
37
  /** `export const fn = async (a) => {}` / `= function () {}`: callable, not data. */
38
- export const RX_EXPORT_CALLABLE_CONST =
38
+ const RX_EXPORT_CALLABLE_CONST =
39
39
  /\bexport\s+(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:function\b|(?:\([^)]*\)|\w+)\s*=>)/g
40
- export const RX_TOP_LEVEL_IMPORT =
40
+ const RX_TOP_LEVEL_IMPORT =
41
41
  /^\s*import\s*(?:(?:[\w_$*{},\s\n]+from\s*)?['"`][^'"`\n]+['"`]|['"`][^'"`\n]+['"`]);?/
42
42
 
43
43
  export const cacheDir = fs.resolve(Bakery.cacheDir, 'vue')
@@ -66,7 +66,6 @@ const CLOSING_TAG = '</script'
66
66
  * non-greedy regex stops at the first match, so server code containing
67
67
  * `"</script>"` would be cut short and its remainder left in the client bundle.
68
68
  */
69
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: character scanner, locates a block end past nested quotes
70
69
  function findServerScriptEnd(raw: string, start: number): number {
71
70
  let index = start
72
71
 
@@ -195,7 +194,6 @@ export function rewriteRelativeImports(
195
194
  * skips strings/comments, so a multi-line object, function, or arrow body
196
195
  * survives intact: stopping at the first newline breaks all three.
197
196
  */
198
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: character scanner, brace and quote state machine
199
197
  function findExpressionEnd(code: string, start: number): number {
200
198
  let depth = 0
201
199
  let index = start
@@ -654,14 +652,20 @@ const RX_RELATIVE_SPECIFIER =
654
652
  * Brackets are percent-encoded: a requested name is read as a glob, where a
655
653
  * bare `[id]` is a character class and never matches the file of that name.
656
654
  */
657
- export function absolutizeRelativeImports(code: string, routePath: string): string {
655
+ export function absolutizeRelativeImports(
656
+ code: string,
657
+ routePath: string,
658
+ ): string {
658
659
  const base = `http://bakery.invalid${routePath.replace(/\\/g, '/')}`
659
- return code.replace(RX_RELATIVE_SPECIFIER, (match, lead: string, quote: string, spec: string) => {
660
- const url = Try.return(() => new URL(spec, base), null)
661
- if (!url) return match
662
- const path = url.pathname.replaceAll('[', '%5B').replaceAll(']', '%5D')
663
- return `${lead}${quote}${path}${url.search}${url.hash}${quote}`
664
- })
660
+ return code.replace(
661
+ RX_RELATIVE_SPECIFIER,
662
+ (match, lead: string, quote: string, spec: string) => {
663
+ const url = Try.return(() => new URL(spec, base), null)
664
+ if (!url) return match
665
+ const path = url.pathname.replaceAll('[', '%5B').replaceAll(']', '%5D')
666
+ return `${lead}${quote}${path}${url.search}${url.hash}${quote}`
667
+ },
668
+ )
665
669
  }
666
670
 
667
671
  export function rewriteVueImports(code: string): string {
@@ -676,7 +680,7 @@ export function rewriteVueImports(code: string): string {
676
680
  * A leading `<meta … />` directive. Quoted attribute values may contain `>`,
677
681
  * so plain `[^>]` would truncate the tag. Anchored: only the prologue counts.
678
682
  */
679
- export const RX_VUE_META = /^<meta(?![\w-])((?:"[^"]*"|'[^']*'|[^>])*?)\/>/i
683
+ const RX_VUE_META = /^<meta(?![\w-])((?:"[^"]*"|'[^']*'|[^>])*?)\/>/i
680
684
  const RX_META_SKIPPABLE = /^\s+|^<!--[\s\S]*?-->/
681
685
 
682
686
  /**