@absolutejs/absolute 0.8.12 → 0.8.13
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/dist/index.js.map +10 -10
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/index.d.ts +2 -2
- package/dist/src/core/pageHandlers.d.ts +2 -2
- package/dist/src/index.d.ts +4 -4
- package/dist/src/plugins/index.d.ts +2 -2
- package/dist/src/plugins/networkingPlugin.d.ts +1 -1
- package/dist/src/svelte/renderToPipeableStream.d.ts +2 -2
- package/dist/src/svelte/renderToReadableStream.d.ts +1 -1
- package/dist/src/svelte/renderToString.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -2
- package/eslint.config.mjs +116 -116
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
"sources": ["../src/constants.ts", "../src/core/build.ts", "../src/build/generateManifest.ts", "../src/build/generateReactIndexes.ts", "../src/build/scanEntryPoints.ts", "../src/build/updateScriptTags.ts", "../src/svelte/compileSvelte.ts", "../src/utils/getDurationString.ts", "../src/utils/validateSafePath.ts", "../src/core/pageHandlers.ts", "../src/svelte/renderToReadableStream.ts", "../src/utils/escapeScriptContent.ts", "../src/plugins/networkingPlugin.ts", "../src/utils/networking.ts", "../src/plugins/pageRouterPlugin.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"export const SECONDS_IN_A_MINUTE = 60;\nexport const MILLISECONDS_IN_A_SECOND = 1000;\nexport const MILLISECONDS_IN_A_MINUTE =\n\tMILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;\nexport const MINUTES_IN_AN_HOUR = 60;\nexport const HOURS_IN_DAY = 24;\nexport const MILLISECONDS_IN_A_DAY =\n\tMILLISECONDS_IN_A_SECOND *\n\tSECONDS_IN_A_MINUTE *\n\tMINUTES_IN_AN_HOUR *\n\tHOURS_IN_DAY;\nexport const TIME_PRECISION = 2;\nexport const TWO_THIRDS = 2 / 3;\nexport const DEFAULT_PORT = 3000;\nexport const DEFAULT_CHUNK_SIZE = 16_384;\n",
|
|
6
|
-
"import { rm, mkdir, cp } from
|
|
6
|
+
"import { rm, mkdir, cp } from 'node:fs/promises';\nimport { basename, join } from 'node:path';\nimport { cwd, exit } from 'node:process';\nimport { $, build as bunBuild } from 'bun';\nimport { generateManifest } from '../build/generateManifest';\nimport { generateReactIndexFiles } from '../build/generateReactIndexes';\nimport { scanEntryPoints } from '../build/scanEntryPoints';\nimport { updateScriptTags } from '../build/updateScriptTags';\nimport { compileSvelte } from '../svelte/compileSvelte';\nimport { BuildConfig } from '../types';\nimport { getDurationString } from '../utils/getDurationString';\nimport { validateSafePath } from '../utils/validateSafePath';\n\nexport const build = async ({\n\tbuildDirectory = 'build',\n\tassetsDirectory,\n\treactDirectory,\n\thtmlDirectory,\n\thtmxDirectory,\n\tsvelteDirectory,\n\ttailwind,\n\toptions\n}: BuildConfig) => {\n\tconst buildStart = performance.now();\n\tconst projectRoot = cwd();\n\n\tconst buildPath = validateSafePath(buildDirectory, projectRoot);\n\tconst assetsPath =\n\t\tassetsDirectory && validateSafePath(assetsDirectory, projectRoot);\n\tconst reactDirectoryPath =\n\t\treactDirectory && validateSafePath(reactDirectory, projectRoot);\n\tconst htmlDirectoryPath =\n\t\thtmlDirectory && validateSafePath(htmlDirectory, projectRoot);\n\tconst htmxPath =\n\t\thtmxDirectory && validateSafePath(htmxDirectory, projectRoot);\n\tconst svelteDirectoryPath =\n\t\tsvelteDirectory && validateSafePath(svelteDirectory, projectRoot);\n\n\tconst reactIndexesPath =\n\t\treactDirectoryPath && join(reactDirectoryPath, 'indexes');\n\tconst reactPagesPath =\n\t\treactDirectoryPath && join(reactDirectoryPath, 'pages');\n\tconst htmlPagesPath = htmlDirectoryPath && join(htmlDirectoryPath, 'pages');\n\tconst htmlScriptsPath =\n\t\thtmlDirectoryPath && join(htmlDirectoryPath, 'scripts');\n\tconst sveltePagesPath =\n\t\tsvelteDirectoryPath && join(svelteDirectoryPath, 'pages');\n\n\tawait rm(buildPath, { force: true, recursive: true });\n\tawait mkdir(buildPath);\n\n\tif (reactIndexesPath && reactPagesPath) {\n\t\tawait generateReactIndexFiles(reactPagesPath, reactIndexesPath);\n\t}\n\n\tif (assetsPath) {\n\t\tawait cp(assetsPath, join(buildPath, 'assets'), {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t}\n\n\tif (htmxPath) {\n\t\tawait mkdir(join(buildPath, 'htmx'));\n\t\tawait cp(htmxPath, join(buildPath, 'htmx'), {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t}\n\n\tif (tailwind) {\n\t\tawait $`bunx @tailwindcss/cli -i ${tailwind.input} -o ${join(buildPath, tailwind.output)}`;\n\t}\n\n\tconst reactEntryPoints = reactIndexesPath\n\t\t? await scanEntryPoints(reactIndexesPath, '*.tsx')\n\t\t: [];\n\tconst svelteEntryPoints = sveltePagesPath\n\t\t? await scanEntryPoints(sveltePagesPath, '*.svelte')\n\t\t: [];\n\tconst htmlEntryPoints = htmlScriptsPath\n\t\t? await scanEntryPoints(htmlScriptsPath, '*.{js,ts}')\n\t\t: [];\n\n\tconst { svelteServerPaths, svelteClientPaths } = svelteDirectoryPath\n\t\t? await compileSvelte(svelteEntryPoints, svelteDirectoryPath)\n\t\t: { svelteClientPaths: [], svelteServerPaths: [] };\n\n\tconst serverEntryPoints = reactEntryPoints\n\t\t.concat(htmlEntryPoints)\n\t\t.concat(svelteServerPaths);\n\n\tif (serverEntryPoints.length === 0) {\n\t\tconsole.warn(\n\t\t\t'No server entry points found, skipping manifest generation'\n\t\t);\n\n\t\treturn null;\n\t}\n\n\tconst { logs: serverLogs, outputs: serverOutputs } = await bunBuild({\n\t\tentrypoints: serverEntryPoints,\n\t\tformat: 'esm',\n\t\tnaming: `[dir]/[name].[hash].[ext]`,\n\t\toutdir: buildPath,\n\t\ttarget: 'bun'\n\t}).catch((error) => {\n\t\tconsole.error('Server build failed:', error);\n\t\texit(1);\n\t});\n\n\tlet clientLogs: typeof serverLogs = [];\n\tlet clientOutputs: typeof serverOutputs = [];\n\tif (svelteDirectoryPath) {\n\t\tconst { logs, outputs } = await bunBuild({\n\t\t\tentrypoints: svelteClientPaths,\n\t\t\tformat: 'esm',\n\t\t\tnaming: `[dir]/[name].[hash].[ext]`,\n\t\t\toutdir: join(buildPath, 'svelte'),\n\t\t\troot: svelteDirectoryPath,\n\t\t\ttarget: 'browser'\n\t\t}).catch((error) => {\n\t\t\tconsole.error('Client build failed:', error);\n\t\t\texit(1);\n\t\t});\n\t\tclientLogs = logs;\n\t\tclientOutputs = outputs;\n\t}\n\n\tserverLogs.concat(clientLogs).forEach((log) => {\n\t\tif (log.level === 'error') console.error(log);\n\t\telse if (log.level === 'warning') console.warn(log);\n\t\telse console.info(log);\n\t});\n\n\tconst allOutputs = serverOutputs.concat(clientOutputs);\n\tconst manifest = generateManifest(allOutputs, buildPath);\n\n\tif (htmlDirectoryPath && htmlPagesPath) {\n\t\tconst outputHtmlPages = join(\n\t\t\tbuildPath,\n\t\t\tbasename(htmlDirectoryPath),\n\t\t\t'pages'\n\t\t);\n\t\tawait mkdir(outputHtmlPages, { recursive: true });\n\t\tawait cp(htmlPagesPath, outputHtmlPages, {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t\tawait updateScriptTags(manifest, outputHtmlPages);\n\t}\n\n\tif (!options?.preserveIntermediateFiles && svelteDirectoryPath) {\n\t\tawait rm(join(svelteDirectoryPath, 'indexes'), {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t\tawait rm(join(svelteDirectoryPath, 'client'), {\n\t\t\tforce: true,\n\t\t\trecursive: true\n\t\t});\n\t\tawait Promise.all(\n\t\t\tsvelteServerPaths.map((filePath) => rm(filePath, { force: true }))\n\t\t);\n\t}\n\n\tif (!options?.preserveIntermediateFiles && reactIndexesPath) {\n\t\tawait rm(reactIndexesPath, { force: true, recursive: true });\n\t}\n\n\tconst buildDuration = performance.now() - buildStart;\n\tconsole.log(`Build completed in ${getDurationString(buildDuration)}`);\n\n\treturn manifest;\n};\n",
|
|
7
7
|
"import { BuildArtifact } from \"bun\";\n\nexport const generateManifest = (\n outputs: BuildArtifact[],\n buildDirectoryAbsolute: string\n) => {\n const manifest = outputs.reduce<Record<string, string>>((accumulator, artifact) => {\n let relativePath = artifact.path.startsWith(buildDirectoryAbsolute)\n ? artifact.path.slice(buildDirectoryAbsolute.length)\n : artifact.path;\n relativePath = relativePath.replace(/^\\/+/, \"\");\n\n const segments = relativePath.split(\"/\");\n const fileWithHash = segments[segments.length - 1];\n if (!fileWithHash) return accumulator;\n\n const [baseName] = fileWithHash.split(`.${artifact.hash}.`);\n\n if (relativePath.includes(\"svelte/pages\")) {\n accumulator[baseName] = artifact.path;\n } else if (relativePath.includes(\"svelte/indexes\")) {\n accumulator[`${baseName}Index`] = `/${relativePath}`;\n } else {\n accumulator[baseName] = `/${relativePath}`;\n }\n\n return accumulator;\n }, {});\n\n return manifest;\n};\n",
|
|
8
8
|
"import { mkdir, rm, writeFile } from \"fs/promises\";\nimport { basename, join } from \"path\";\nimport { Glob } from \"bun\";\n\nexport const generateReactIndexFiles = async (\n reactPagesDirectory: string,\n reactIndexesDirectory: string\n) => {\n await rm(reactIndexesDirectory, { force: true, recursive: true });\n await mkdir(reactIndexesDirectory);\n\n const pagesGlob = new Glob(\"*.*\");\n const files: string[] = [];\n for await (const file of pagesGlob.scan({ cwd: reactPagesDirectory })) {\n files.push(file);\n }\n const promises = files.map(async (file) => {\n const fileName = basename(file);\n const [componentName] = fileName.split(\".\");\n const content = [\n `import { hydrateRoot } from 'react-dom/client';`,\n `import type { ComponentType } from 'react'`,\n `import { ${componentName} } from '../pages/${componentName}';\\n`,\n `type PropsOf<C> = C extends ComponentType<infer P> ? P : never;\\n`,\n `declare global {`,\n `\\tinterface Window {`,\n `\\t\\t__INITIAL_PROPS__: PropsOf<typeof ${componentName}>`,\n `\\t}`,\n `}\\n`,\n `hydrateRoot(document, <${componentName} {...window.__INITIAL_PROPS__} />);`\n ].join(\"\\n\");\n\n return writeFile(\n join(reactIndexesDirectory, `${componentName}Index.tsx`),\n content\n );\n });\n await Promise.all(promises);\n};",
|
|
9
9
|
"import { Glob } from \"bun\";\n\nexport const scanEntryPoints = async (dir: string, pattern: string) => {\n\tconst entryPaths: string[] = [];\n\tconst glob = new Glob(pattern);\n\tfor await (const file of glob.scan({ absolute: true, cwd: dir })) {\n\t\tentryPaths.push(file);\n\t}\n\n\treturn entryPaths;\n};\n",
|
|
10
10
|
"import { readFile, writeFile } from \"node:fs/promises\";\nimport { scanEntryPoints } from \"./scanEntryPoints\";\n\nexport const updateScriptTags = async (\n\tmanifest: Record<string, string>,\n\thtmlDir: string\n) => {\n\tconst htmlFiles = await scanEntryPoints(htmlDir, \"*.html\");\n\n\tconst tasks = htmlFiles.map(async (filePath) => {\n\t\tconst original = await readFile(filePath, \"utf8\");\n\t\tconst updated = Object.entries(manifest).reduce(\n\t\t\t(html, [scriptName, newPath]) => {\n\t\t\t\tconst esc = scriptName.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\t\t\t\tconst regex = new RegExp(\n\t\t\t\t\t`(<script[^>]+src=[\"'])(/?(?:.*/)?${esc})(?:\\\\.[^.\"'/]+)?(\\\\.js)([\"'][^>]*>)`,\n\t\t\t\t\t\"g\"\n\t\t\t\t);\n\n\t\t\t\treturn html.replace(\n\t\t\t\t\tregex,\n\t\t\t\t\t(_, prefix, __, ___, suffix) =>\n\t\t\t\t\t\t`${prefix}${newPath}${suffix}`\n\t\t\t\t);\n\t\t\t},\n\t\t\toriginal\n\t\t);\n\n\t\tawait writeFile(filePath, updated, \"utf8\");\n\t});\n\n\tawait Promise.all(tasks);\n};\n",
|
|
11
|
-
"import { mkdir } from
|
|
12
|
-
"import {\n\tMILLISECONDS_IN_A_SECOND,\n\tTIME_PRECISION,\n\tMILLISECONDS_IN_A_MINUTE\n} from
|
|
13
|
-
"import { resolve, relative, sep } from
|
|
14
|
-
"import { file } from
|
|
15
|
-
"import type { Component } from
|
|
16
|
-
"const ESCAPE_LOOKUP: Record<string, string> = {\n\t
|
|
17
|
-
"import { argv } from
|
|
18
|
-
"import os from
|
|
19
|
-
"export const pageRouterPlugin = () => {\n\tconsole.log(
|
|
11
|
+
"import { mkdir } from 'node:fs/promises';\nimport { basename, join } from 'node:path';\nimport { env } from 'node:process';\nimport { write, file } from 'bun';\nimport { compile, preprocess } from 'svelte/compiler';\n\nexport const compileSvelte = async (\n\tentryPoints: string[],\n\toutputDirectory: string\n) => {\n\tconst pagesDir = join(outputDirectory, 'pages');\n\tconst clientDir = join(outputDirectory, 'client');\n\tconst indexesDir = join(outputDirectory, 'indexes');\n\n\tawait Promise.all([\n\t\tmkdir(clientDir, { recursive: true }),\n\t\tmkdir(indexesDir, { recursive: true })\n\t]);\n\n\tconst isDev = env.NODE_ENV === 'development';\n\n\tconst builds = await Promise.all(\n\t\tentryPoints.map(async (entry) => {\n\t\t\tconst source = await file(entry).text();\n\t\t\tconst { code: pre } = await preprocess(source, {});\n\n\t\t\tconst name = basename(entry, '.svelte');\n\n\t\t\tconst { js: ssrJs } = compile(pre, {\n\t\t\t\tcss: 'injected',\n\t\t\t\tdev: isDev,\n\t\t\t\tfilename: entry,\n\t\t\t\tgenerate: 'server'\n\t\t\t});\n\t\t\tconst ssrPath = join(pagesDir, `${name}.js`);\n\n\t\t\tconst { js: clientJs } = compile(pre, {\n\t\t\t\tcss: 'injected',\n\t\t\t\tdev: isDev,\n\t\t\t\tfilename: entry,\n\t\t\t\tgenerate: 'client'\n\t\t\t});\n\t\t\tconst clientComponentPath = join(clientDir, `${name}.js`);\n\n\t\t\tconst bootstrap = `import Component from \"../client/${name}.js\";\nimport { hydrate } from \"svelte\";\nhydrate(Component,{target:document.body,props:window.__INITIAL_PROPS__??{}});`;\n\t\t\tconst clientIndexPath = join(indexesDir, `${name}.js`);\n\n\t\t\tawait Promise.all([\n\t\t\t\twrite(ssrPath, ssrJs.code),\n\t\t\t\twrite(clientComponentPath, clientJs.code),\n\t\t\t\twrite(clientIndexPath, bootstrap)\n\t\t\t]);\n\n\t\t\treturn { clientIndexPath, ssrPath };\n\t\t})\n\t);\n\n\treturn {\n\t\tsvelteClientPaths: builds.map(({ clientIndexPath }) => clientIndexPath),\n\t\tsvelteServerPaths: builds.map(({ ssrPath }) => ssrPath)\n\t};\n};\n",
|
|
12
|
+
"import {\n\tMILLISECONDS_IN_A_SECOND,\n\tTIME_PRECISION,\n\tMILLISECONDS_IN_A_MINUTE\n} from '../constants';\n\nexport const getDurationString = (duration: number) => {\n\tlet durationString;\n\n\tif (duration < MILLISECONDS_IN_A_SECOND) {\n\t\tdurationString = `${duration.toFixed(TIME_PRECISION)}ms`;\n\t} else if (duration < MILLISECONDS_IN_A_MINUTE) {\n\t\tdurationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;\n\t} else {\n\t\tdurationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;\n\t}\n\n\treturn durationString;\n};\n",
|
|
13
|
+
"import { resolve, relative, sep } from 'node:path';\n\nexport const validateSafePath = (targetPath: string, baseDirectory: string) => {\n\tconst absoluteBase = resolve(baseDirectory);\n\tconst absoluteTarget = resolve(baseDirectory, targetPath);\n\tif (relative(absoluteBase, absoluteTarget).startsWith(`..${sep}`)) {\n\t\tthrow new Error(`Unsafe path: ${targetPath}`);\n\t}\n\n\treturn absoluteTarget;\n};\n",
|
|
14
|
+
"import { file } from 'bun';\nimport { ComponentType, createElement } from 'react';\nimport { renderToReadableStream as renderReactToReadableStream } from 'react-dom/server';\nimport { Component } from 'svelte';\nimport { renderToReadableStream as renderSvelteToReadableStream } from '../svelte/renderToReadableStream';\n\nexport const handleReactPageRequest = async <\n\tProps extends Record<string, unknown> = Record<never, never>\n>(\n\tpageComponent: ComponentType<Props>,\n\tindex: string,\n\t...props: keyof Props extends never ? [] : [props: Props]\n) => {\n\tconst [maybeProps] = props;\n\tconst element =\n\t\tmaybeProps !== undefined\n\t\t\t? createElement(pageComponent, maybeProps)\n\t\t\t: createElement(pageComponent);\n\n\tconst stream = await renderReactToReadableStream(element, {\n\t\tbootstrapModules: [index],\n\t\tbootstrapScriptContent: maybeProps\n\t\t\t? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}`\n\t\t\t: undefined\n\t});\n\n\treturn new Response(stream, {\n\t\theaders: { 'Content-Type': 'text/html' }\n\t});\n};\n\n// Declare overloads matching Svelte’s own component API to preserve correct type inference\ntype HandleSveltePageRequest = {\n\t(\n\t\tPageComponent: Component<Record<string, never>>,\n\t\tmanifest: Record<string, string>\n\t): Promise<Response>;\n\t<P extends Record<string, unknown>>(\n\t\tPageComponent: Component<P>,\n\t\tmanifest: Record<string, string>,\n\t\tprops: P\n\t): Promise<Response>;\n};\n\nexport const handleSveltePageRequest: HandleSveltePageRequest = async <\n\tP extends Record<string, unknown>\n>(\n\tPageComponent: Component<P>,\n\tmanifest: Record<string, string>,\n\tprops?: P\n) => {\n\tconst componentPath = PageComponent.toString();\n\tconst pathSegments = componentPath.split('/');\n\tconst lastSegment = pathSegments[pathSegments.length - 1] ?? '';\n\tconst componentName = lastSegment.replace(/\\.svelte$/, '');\n\n\tconst pagePath = manifest[componentName];\n\tconst indexPath = manifest[`${componentName}Index`];\n\n\tconst { default: ImportedPageComponent } = await import(pagePath);\n\n\tconst stream = await renderSvelteToReadableStream(\n\t\tImportedPageComponent,\n\t\tprops,\n\t\t{\n\t\t\tbootstrapModules: [indexPath],\n\t\t\tbootstrapScriptContent: `window.__INITIAL_PROPS__=${JSON.stringify(\n\t\t\t\tprops\n\t\t\t)}`\n\t\t}\n\t);\n\n\treturn new Response(stream, {\n\t\theaders: { 'Content-Type': 'text/html' }\n\t});\n};\n\nexport const handleHTMLPageRequest = (html: string) => file(html);\n",
|
|
15
|
+
"import type { Component } from 'svelte';\nimport { render } from 'svelte/server';\nimport { DEFAULT_CHUNK_SIZE } from '../constants';\nimport { escapeScriptContent } from '../utils/escapeScriptContent';\n\nexport type RenderStreamOptions = {\n\tbootstrapScriptContent?: string;\n\tbootstrapScripts?: string[];\n\tbootstrapModules?: string[];\n\tnonce?: string;\n\tonError?: (error: unknown) => void;\n\tprogressiveChunkSize?: number;\n\tsignal?: AbortSignal;\n};\n\nexport const renderToReadableStream = async <\n\tProps extends Record<string, unknown> = Record<string, never>\n>(\n\tcomponent: Component<Props>,\n\tprops?: Props,\n\t{\n\t\tbootstrapScriptContent,\n\t\tbootstrapScripts = [],\n\t\tbootstrapModules = [],\n\t\tnonce,\n\t\tonError = console.error,\n\t\tprogressiveChunkSize = DEFAULT_CHUNK_SIZE,\n\t\tsignal\n\t}: RenderStreamOptions = {}\n) => {\n\ttry {\n\t\tconst { head, body } =\n\t\t\ttypeof props === 'undefined'\n\t\t\t\t? // @ts-expect-error Svelte's render function can't determine which overload to choose when the component is generic\n\t\t\t\t\trender(component)\n\t\t\t\t: render(component, { props });\n\t\tconst nonceAttr = nonce ? ` nonce=\"${nonce}\"` : '';\n\t\tconst scripts =\n\t\t\t(bootstrapScriptContent\n\t\t\t\t? `<script${nonceAttr}>${escapeScriptContent(bootstrapScriptContent)}</script>`\n\t\t\t\t: '') +\n\t\t\tbootstrapScripts\n\t\t\t\t.map((src) => `<script${nonceAttr} src=\"${src}\"></script>`)\n\t\t\t\t.join('') +\n\t\t\tbootstrapModules\n\t\t\t\t.map(\n\t\t\t\t\t(src) =>\n\t\t\t\t\t\t`<script${nonceAttr} type=\"module\" src=\"${src}\"></script>`\n\t\t\t\t)\n\t\t\t\t.join('');\n\t\tconst encoder = new TextEncoder();\n\t\t// Warning: this encodes the entire document into memory in one buffer\n\t\tconst full = encoder.encode(\n\t\t\t`<!DOCTYPE html><html lang=\"en\"><head>${head}</head><body>${body}${scripts}</body></html>`\n\t\t);\n\n\t\tlet offset = 0;\n\n\t\treturn new ReadableStream<Uint8Array>({\n\t\t\ttype: 'bytes',\n\t\t\tcancel(reason) {\n\t\t\t\tonError?.(reason);\n\t\t\t},\n\t\t\tpull(controller) {\n\t\t\t\tif (signal?.aborted) {\n\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (offset >= full.length) {\n\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst end = Math.min(\n\t\t\t\t\toffset + progressiveChunkSize,\n\t\t\t\t\tfull.length\n\t\t\t\t);\n\t\t\t\tcontroller.enqueue(full.subarray(offset, end));\n\t\t\t\toffset = end;\n\t\t\t}\n\t\t});\n\t} catch (error) {\n\t\tonError?.(error);\n\t\tthrow error;\n\t}\n};\n",
|
|
16
|
+
"const ESCAPE_LOOKUP: Record<string, string> = {\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029',\n\t'&': '\\\\u0026',\n\t'<': '\\\\u003C',\n\t'>': '\\\\u003E'\n};\n\nconst ESCAPE_REGEX = /[&><\\u2028\\u2029]/g;\n\nexport const escapeScriptContent = (content: string) =>\n\tcontent.replace(ESCAPE_REGEX, (char) => ESCAPE_LOOKUP[char]);\n",
|
|
17
|
+
"import { argv } from 'node:process';\nimport { env } from 'bun';\nimport { Elysia } from 'elysia';\nimport { DEFAULT_PORT } from '../constants';\nimport { getLocalIPAddress } from '../utils/networking';\n\nlet host = env.HOST ?? 'localhost';\nconst port = env.PORT ?? DEFAULT_PORT;\nlet localIP: string | undefined;\n\nconst args = argv;\nconst hostFlag = args.includes('--host');\n\nif (hostFlag) {\n\tlocalIP = getLocalIPAddress();\n\thost = '0.0.0.0';\n}\n\nexport const networkingPlugin = (app: Elysia) =>\n\tapp.listen(\n\t\t{\n\t\t\thostname: host,\n\t\t\tport: port\n\t\t},\n\t\t() => {\n\t\t\t//TODO: I dont think this works properly\n\t\t\tif (hostFlag) {\n\t\t\t\tconsole.log(`Server started on http://localhost:${port}`);\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Server started on network: http://${localIP}:${port}`\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.log(`Server started on http://${host}:${port}`);\n\t\t\t}\n\t\t}\n\t);\n",
|
|
18
|
+
"import os from 'os';\n\nexport const getLocalIPAddress = () => {\n\tconst interfaces = os.networkInterfaces();\n\tconst addresses = Object.values(interfaces)\n\t\t.flat()\n\t\t.filter(\n\t\t\t(iface): iface is os.NetworkInterfaceInfo => iface !== undefined\n\t\t);\n\tconst ipAddress = addresses.find(\n\t\t(iface) => iface.family === 'IPv4' && !iface.internal\n\t);\n\n\tif (ipAddress) return ipAddress.address; // Return the first non-internal IPv4 address\n\n\tconsole.warn('No IP address found, falling back to localhost');\n\n\treturn 'localhost'; // Fallback to localhost if no IP found\n};\n",
|
|
19
|
+
"export const pageRouterPlugin = () => {\n\tconsole.log('Page Router Plugin Not Implemented Yet');\n};\n"
|
|
20
20
|
],
|
|
21
21
|
"mappings": ";;AAAO,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,2BACZ,2BAA2B;AACrB,IAAM,qBAAqB;AAC3B,IAAM,eAAe;AACrB,IAAM,wBACZ,2BACA,sBACA,qBACA;AACM,IAAM,iBAAiB;AACvB,IAAM,aAAa,IAAI;AACvB,IAAM,eAAe;AACrB,IAAM,qBAAqB;;ACdlC,eAAS,cAAI;AACb,qBAAS,mBAAU;AACnB;AACA;;;ACDO,IAAM,mBAAmB,CAC9B,SACA,2BACG;AAAA,EACH,MAAM,WAAW,QAAQ,OAA+B,CAAC,aAAa,aAAa;AAAA,IACjF,IAAI,eAAe,SAAS,KAAK,WAAW,sBAAsB,IAC9D,SAAS,KAAK,MAAM,uBAAuB,MAAM,IACjD,SAAS;AAAA,IACb,eAAe,aAAa,QAAQ,QAAQ,EAAE;AAAA,IAE9C,MAAM,WAAW,aAAa,MAAM,GAAG;AAAA,IACvC,MAAM,eAAe,SAAS,SAAS,SAAS;AAAA,IAChD,KAAK;AAAA,MAAc,OAA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ACb,QAAQ,IAAI,sCAAsC,MAAM;AAAA,IACxD,QAAQ,IACP,qCAAqC,WAAW,MACjD;AAAA,EACD,EAAO;AAAA,IACN,QAAQ,IAAI,4BAA4B,QAAQ,MAAM;AAAA;AAAA,CAGzD;;AEnCM,IAAM,mBAAmB,MAAM;AAAA,EACrC,QAAQ,IAAI,wCAAwC;AAAA;",
|
|
22
22
|
"debugId": "1126AFF718BB279B64756E2164756E21",
|
package/dist/src/core/build.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BuildConfig } from
|
|
1
|
+
import { BuildConfig } from '../types';
|
|
2
2
|
export declare const build: ({ buildDirectory, assetsDirectory, reactDirectory, htmlDirectory, htmxDirectory, svelteDirectory, tailwind, options }: BuildConfig) => Promise<Record<string, string> | null>;
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './build';
|
|
2
|
+
export * from './pageHandlers';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentType } from
|
|
2
|
-
import { Component } from
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { Component } from 'svelte';
|
|
3
3
|
export declare const handleReactPageRequest: <Props extends Record<string, unknown> = Record<never, never>>(pageComponent: ComponentType<Props>, index: string, ...props: keyof Props extends never ? [] : [props: Props]) => Promise<Response>;
|
|
4
4
|
type HandleSveltePageRequest = {
|
|
5
5
|
(PageComponent: Component<Record<string, never>>, manifest: Record<string, string>): Promise<Response>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './core/index';
|
|
3
|
+
export * from './plugins/index';
|
|
4
|
+
export * from './utils/index';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './networkingPlugin';
|
|
2
|
+
export * from './pageRouterPlugin';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Readable } from
|
|
2
|
-
import type { Component } from
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
3
|
export type RenderPipeableOptions = {
|
|
4
4
|
bootstrapScriptContent?: string;
|
|
5
5
|
bootstrapScripts?: string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './networking';
|
|
2
|
+
export * from '../build/updateScriptTags';
|
package/eslint.config.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// eslint.config.mjs
|
|
2
|
-
import { dirname } from
|
|
3
|
-
import { fileURLToPath } from
|
|
4
|
-
import pluginJs from
|
|
5
|
-
import stylisticTs from
|
|
6
|
-
import tsParser from
|
|
7
|
-
import { defineConfig } from
|
|
8
|
-
import absolutePlugin from
|
|
9
|
-
import importPlugin from
|
|
10
|
-
import promisePlugin from
|
|
11
|
-
import securityPlugin from
|
|
12
|
-
import globals from
|
|
13
|
-
import tseslint from
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import pluginJs from '@eslint/js';
|
|
5
|
+
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
|
6
|
+
import tsParser from '@typescript-eslint/parser';
|
|
7
|
+
import { defineConfig } from 'eslint/config';
|
|
8
|
+
import absolutePlugin from 'eslint-plugin-absolute';
|
|
9
|
+
import importPlugin from 'eslint-plugin-import';
|
|
10
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
11
|
+
import securityPlugin from 'eslint-plugin-security';
|
|
12
|
+
import globals from 'globals';
|
|
13
|
+
import tseslint from 'typescript-eslint';
|
|
14
14
|
|
|
15
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
16
|
|
|
17
17
|
export default defineConfig([
|
|
18
18
|
{
|
|
19
19
|
ignores: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
'dist/**',
|
|
21
|
+
'example/build/**',
|
|
22
|
+
'example/svelte/indexes/',
|
|
23
|
+
'example/svelte/client/',
|
|
24
|
+
'example/svelte/pages/*.js',
|
|
25
|
+
'tailwind.config.ts',
|
|
26
|
+
'postcss.config.ts'
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
|
|
@@ -32,30 +32,30 @@ export default defineConfig([
|
|
|
32
32
|
...tseslint.configs.recommended,
|
|
33
33
|
|
|
34
34
|
{
|
|
35
|
-
files: [
|
|
35
|
+
files: ['**/*.{ts,tsx}'],
|
|
36
36
|
languageOptions: {
|
|
37
37
|
globals: globals.browser,
|
|
38
38
|
parser: tsParser,
|
|
39
39
|
parserOptions: {
|
|
40
40
|
createDefaultProgram: true,
|
|
41
|
-
project:
|
|
41
|
+
project: './tsconfig.json',
|
|
42
42
|
tsconfigRootDir: __dirname
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
plugins: {
|
|
45
|
+
plugins: { '@stylistic/ts': stylisticTs },
|
|
46
46
|
rules: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{ blankLine:
|
|
47
|
+
'@stylistic/ts/padding-line-between-statements': [
|
|
48
|
+
'error',
|
|
49
|
+
{ blankLine: 'always', next: 'return', prev: '*' }
|
|
50
50
|
],
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error'
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
|
|
56
56
|
{
|
|
57
|
-
files: [
|
|
58
|
-
ignores: [
|
|
57
|
+
files: ['**/*.{js,mjs,cjs,ts,tsx,jsx}'],
|
|
58
|
+
ignores: ['node_modules/**'],
|
|
59
59
|
plugins: {
|
|
60
60
|
absolute: absolutePlugin,
|
|
61
61
|
import: importPlugin,
|
|
@@ -63,139 +63,139 @@ export default defineConfig([
|
|
|
63
63
|
security: securityPlugin
|
|
64
64
|
},
|
|
65
65
|
rules: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{ allowedVars: [
|
|
66
|
+
'absolute/explicit-object-types': 'error',
|
|
67
|
+
'absolute/localize-react-props': 'error',
|
|
68
|
+
'absolute/max-depth-extended': ['error', 1],
|
|
69
|
+
'absolute/max-jsxnesting': ['error', 5],
|
|
70
|
+
'absolute/min-var-length': [
|
|
71
|
+
'error',
|
|
72
|
+
{ allowedVars: ['_', 'id', 'db', 'OK'], minLength: 3 }
|
|
73
73
|
],
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
'absolute/no-explicit-return-type': 'error',
|
|
75
|
+
'absolute/no-useless-function': 'error',
|
|
76
|
+
'absolute/sort-exports': [
|
|
77
|
+
'error',
|
|
78
78
|
{
|
|
79
79
|
caseSensitive: true,
|
|
80
80
|
natural: true,
|
|
81
|
-
order:
|
|
81
|
+
order: 'asc',
|
|
82
82
|
variablesBeforeFunctions: true
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
'absolute/sort-keys-fixable': [
|
|
86
|
+
'error',
|
|
87
87
|
{
|
|
88
88
|
caseSensitive: true,
|
|
89
89
|
natural: true,
|
|
90
|
-
order:
|
|
90
|
+
order: 'asc',
|
|
91
91
|
variablesBeforeFunctions: true
|
|
92
92
|
}
|
|
93
93
|
],
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
eqeqeq:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
95
|
+
'consistent-return': 'error',
|
|
96
|
+
eqeqeq: 'error',
|
|
97
|
+
'func-style': [
|
|
98
|
+
'error',
|
|
99
|
+
'expression',
|
|
100
100
|
{ allowArrowFunctions: true }
|
|
101
101
|
],
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
102
|
+
'import/no-cycle': 'error',
|
|
103
|
+
'import/no-default-export': 'error',
|
|
104
|
+
'import/no-relative-packages': 'error',
|
|
105
|
+
'import/no-unused-modules': ['error', { missingExports: true }],
|
|
106
|
+
'import/order': ['error', { alphabetize: { order: 'asc' } }],
|
|
107
|
+
'no-await-in-loop': 'error',
|
|
108
|
+
'no-debugger': 'error',
|
|
109
|
+
'no-duplicate-case': 'error',
|
|
110
|
+
'no-duplicate-imports': 'error',
|
|
111
|
+
'no-else-return': 'error',
|
|
112
|
+
'no-empty-function': 'error',
|
|
113
|
+
'no-empty-pattern': 'error',
|
|
114
|
+
'no-empty-static-block': 'error',
|
|
115
|
+
'no-fallthrough': 'error',
|
|
116
|
+
'no-floating-decimal': 'error',
|
|
117
|
+
'no-global-assign': 'error',
|
|
118
|
+
'no-implicit-coercion': 'error',
|
|
119
|
+
'no-implicit-globals': 'error',
|
|
120
|
+
'no-loop-func': 'error',
|
|
121
|
+
'no-magic-numbers': [
|
|
122
|
+
'warn',
|
|
123
123
|
{ detectObjects: false, enforceConst: true, ignore: [0, 1, 2] }
|
|
124
124
|
],
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
'no-misleading-character-class': 'error',
|
|
126
|
+
'no-nested-ternary': 'error',
|
|
127
|
+
'no-new-native-nonconstructor': 'error',
|
|
128
|
+
'no-new-wrappers': 'error',
|
|
129
|
+
'no-param-reassign': 'error',
|
|
130
|
+
'no-restricted-imports': [
|
|
131
|
+
'error',
|
|
132
132
|
{
|
|
133
133
|
paths: [
|
|
134
134
|
{
|
|
135
|
-
importNames: [
|
|
135
|
+
importNames: ['default'],
|
|
136
136
|
message:
|
|
137
|
-
|
|
138
|
-
name:
|
|
137
|
+
'Import only named React exports for tree-shaking.',
|
|
138
|
+
name: 'react'
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
importNames: [
|
|
142
|
-
message:
|
|
143
|
-
name:
|
|
141
|
+
importNames: ['default'],
|
|
142
|
+
message: 'Import only the required Bun exports.',
|
|
143
|
+
name: 'bun'
|
|
144
144
|
}
|
|
145
145
|
]
|
|
146
146
|
}
|
|
147
147
|
],
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
'no-return-await': 'error',
|
|
149
|
+
'no-shadow': 'error',
|
|
150
|
+
'no-undef': 'error',
|
|
151
|
+
'no-unneeded-ternary': 'error',
|
|
152
|
+
'no-unreachable': 'error',
|
|
153
|
+
'no-useless-assignment': 'error',
|
|
154
|
+
'no-useless-concat': 'error',
|
|
155
|
+
'no-useless-return': 'error',
|
|
156
|
+
'no-var': 'error',
|
|
157
|
+
'prefer-arrow-callback': 'error',
|
|
158
|
+
'prefer-const': 'error',
|
|
159
|
+
'prefer-destructuring': [
|
|
160
|
+
'error',
|
|
161
161
|
{ array: true, object: true },
|
|
162
162
|
{ enforceForRenamedProperties: false }
|
|
163
163
|
],
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
'prefer-template': 'error',
|
|
165
|
+
'promise/always-return': 'warn',
|
|
166
|
+
'promise/avoid-new': 'warn',
|
|
167
|
+
'promise/catch-or-return': 'error',
|
|
168
|
+
'promise/no-callback-in-promise': 'warn',
|
|
169
|
+
'promise/no-nesting': 'warn',
|
|
170
|
+
'promise/no-promise-in-callback': 'warn',
|
|
171
|
+
'promise/no-return-wrap': 'error',
|
|
172
|
+
'promise/param-names': 'error'
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
|
|
176
176
|
{
|
|
177
|
-
files: [
|
|
177
|
+
files: ['eslint.config.mjs', 'src/constants.ts'],
|
|
178
178
|
rules: {
|
|
179
|
-
|
|
179
|
+
'no-magic-numbers': 'off'
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
|
-
files: [
|
|
183
|
+
files: ['eslint.config.mjs'],
|
|
184
184
|
rules: {
|
|
185
|
-
|
|
185
|
+
'import/no-default-export': 'off'
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
files: [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
'src/utils/index.ts',
|
|
191
|
+
'src/plugins/index.ts',
|
|
192
|
+
'src/core/index.ts',
|
|
193
|
+
'src/index.ts',
|
|
194
|
+
'example/**/indexes/*',
|
|
195
|
+
'example/html/scripts/*'
|
|
196
196
|
],
|
|
197
197
|
rules: {
|
|
198
|
-
|
|
198
|
+
'import/no-unused-modules': 'off'
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
]);
|