@torpor/build 0.4.8 → 0.4.10
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/nav.mjs +3 -1
- package/dist/nav.mjs.map +1 -1
- package/package.json +7 -3
- package/CHANGELOG.md +0 -467
- package/scripts/postbuild.ts +0 -12
- package/src/bin/index.ts +0 -11
- package/src/index.ts +0 -30
- package/src/nav/formSubmit.ts +0 -49
- package/src/nav/load.ts +0 -9
- package/src/nav/loadData.ts +0 -134
- package/src/nav/navigate.ts +0 -164
- package/src/nav/reload.ts +0 -9
- package/src/nav.ts +0 -4
- package/src/response/badRequest.ts +0 -19
- package/src/response/created.ts +0 -20
- package/src/response/forbidden.ts +0 -21
- package/src/response/found.ts +0 -30
- package/src/response/methodNotAllowed.ts +0 -18
- package/src/response/movedPermanently.ts +0 -25
- package/src/response/notFound.ts +0 -24
- package/src/response/notModified.ts +0 -34
- package/src/response/ok.ts +0 -29
- package/src/response/permanentRedirect.ts +0 -30
- package/src/response/response.ts +0 -22
- package/src/response/seeOther.ts +0 -19
- package/src/response/serverError.ts +0 -24
- package/src/response/temporaryRedirect.ts +0 -31
- package/src/response/transfer.ts +0 -14
- package/src/response/unauthorized.ts +0 -21
- package/src/response/unprocessable.ts +0 -18
- package/src/response.ts +0 -37
- package/src/run/prepareTemplate.ts +0 -39
- package/src/run/run.ts +0 -62
- package/src/run/runBuild.ts +0 -77
- package/src/run/runDev.ts +0 -89
- package/src/run/runPreview.ts +0 -93
- package/src/run.ts +0 -6
- package/src/server/CookieHelper.ts +0 -36
- package/src/server/HeaderHelper.ts +0 -25
- package/src/server/Routerx.ts +0 -72
- package/src/server/Server.ts +0 -144
- package/src/server/ServerEvent.ts +0 -39
- package/src/server/connect/bufferToArrayBuffer.ts +0 -8
- package/src/server/connect/connectMiddleware.ts +0 -81
- package/src/server/connect/flattenHeaders.ts +0 -44
- package/src/server/connect/nodeMessageToNodeResponse.ts +0 -89
- package/src/server/connect/readableToBuffer.ts +0 -16
- package/src/server/connect/requestToNodeMessage.ts +0 -26
- package/src/server/contentType.ts +0 -85
- package/src/server/types/HttpMethod.ts +0 -12
- package/src/server/types/MiddlewareFunction.ts +0 -8
- package/src/server/types/ServerFunction.ts +0 -7
- package/src/server.ts +0 -7
- package/src/site/Router.ts +0 -164
- package/src/site/Site.ts +0 -214
- package/src/site/clientEntry.ts +0 -108
- package/src/site/clientEntryDev.ts +0 -3
- package/src/site/defaultAdapter.ts +0 -11
- package/src/site/manifest.ts +0 -54
- package/src/site/serverEntry.ts +0 -417
- package/src/state/$page.ts +0 -24
- package/src/state/client.ts +0 -15
- package/src/state.ts +0 -3
- package/src/test/runTest.ts +0 -350
- package/src/test.ts +0 -3
- package/src/types/Adapter.ts +0 -8
- package/src/types/ClientState.ts +0 -8
- package/src/types/InternalState.ts +0 -7
- package/src/types/LayoutHandler.ts +0 -5
- package/src/types/LayoutPath.ts +0 -10
- package/src/types/ManifestRoute.ts +0 -6
- package/src/types/PageEndPoint.ts +0 -39
- package/src/types/PageLoadEvent.ts +0 -14
- package/src/types/PageServerAction.ts +0 -7
- package/src/types/PageServerEndPoint.ts +0 -16
- package/src/types/PageServerLoad.ts +0 -7
- package/src/types/PageState.ts +0 -8
- package/src/types/Route.ts +0 -11
- package/src/types/RouteHandler.ts +0 -16
- package/src/types/RouteLayoutHandler.ts +0 -5
- package/src/types/RouteMatchResult.ts +0 -7
- package/src/types/RouteType.ts +0 -19
- package/src/types/ServerEndPoint.ts +0 -37
- package/src/types/ServerHook.ts +0 -11
- package/src/types/ServerLoadEvent.ts +0 -37
- package/src/types/ServerRequest.ts +0 -7
- package/src/utils/pathToRegex.ts +0 -15
- package/src/vite-env.d.ts +0 -2
- package/test/api/_hook.server.ts +0 -3
- package/test/api/posts/+page.server.ts +0 -3
- package/test/api/posts/[id]/+page.server.ts +0 -3
- package/test/app.test.ts +0 -47
- package/test/router.test.ts +0 -78
- package/test/routes/+page.server.ts +0 -3
- package/test/routes/+page.ts +0 -3
- package/test/routes/_error.ts +0 -3
- package/test/routes/_hook.server.ts +0 -3
- package/test/routes/_layout.server.ts +0 -3
- package/test/routes/_layout.ts +0 -3
- package/test/routes/posts/+page.ts +0 -3
- package/test/routes/posts/[id]/+page.ts +0 -3
- package/test/site.test.ts +0 -40
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -18
- package/vitest.config.ts +0 -3
package/dist/nav.mjs
CHANGED
|
@@ -25,7 +25,9 @@ async function formSubmit(e) {
|
|
|
25
25
|
e.preventDefault();
|
|
26
26
|
$page_default.form = void 0;
|
|
27
27
|
const form = e.target;
|
|
28
|
-
const
|
|
28
|
+
const button = e.submitter;
|
|
29
|
+
let action = form.action || document.URL;
|
|
30
|
+
if (button && button.formAction && button.formAction !== document.URL) action = button.formAction;
|
|
29
31
|
const options = {
|
|
30
32
|
body: new FormData(form),
|
|
31
33
|
method: "POST",
|
package/dist/nav.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.mjs","names":["CLIENT_SYMBOL: unique symbol","client: ClientState","client","layoutEndPoint: PageEndPoint | undefined","layoutServerEndPoint: PageServerEndPoint | undefined","client","clientEndPoint: PageEndPoint | undefined","serverEndPoint: PageServerEndPoint | undefined","newLayoutStack: LayoutPath[]","form: Record<string, string> | undefined","$props: Record<string, any>","$page","slots: Record<string, SlotRender> | undefined","slotFunctions: SlotRender[]","parent","layoutEndPoint: PageEndPoint | undefined","$context"],"sources":["../src/state/client.ts","../src/nav/reload.ts","../src/nav/formSubmit.ts","../src/nav/loadData.ts","../src/nav/navigate.ts","../src/nav/load.ts"],"sourcesContent":["import type ClientState from \"../types/ClientState\";\n\nconst CLIENT_SYMBOL: unique symbol = Symbol.for(\"t_client_state\");\n\nconst client: ClientState =\n\t// @ts-ignore\n\t(globalThis[CLIENT_SYMBOL] ??= {\n\t\t// @ts-ignore This will definitely, 100% get set\n\t\trouter: null,\n\t\tlayoutStack: [],\n\t\t// TODO: Probably expire after 30 seconds or something?\n\t\tprefetchedData: {},\n\t});\n\nexport default client;\n","import navigate from \"./navigate\";\n\n/**\n * Reloads data for the currently loaded page and rerenders it.\n */\nexport default async function reload(): Promise<boolean> {\n\tconst url = new URL(document.location.href);\n\treturn await navigate(url);\n}\n","import $page from \"../state/$page\";\nimport load from \"./load\";\nimport reload from \"./reload\";\n\nexport default async function formSubmit(e: SubmitEvent): Promise<void> {\n\t// We'll take it from here\n\te.preventDefault();\n\n\t// Reset $page on submit and link navigation\n\t// TODO: Should we put data in $page.data??\n\t$page.form = undefined;\n\n\t// Perform a POST fetch to the form's action location\n\tconst form = e.target as HTMLFormElement;\n\tconst action = (e.submitter as HTMLButtonElement)?.formAction ?? form.action;\n\tconst options = {\n\t\tbody: new FormData(form),\n\t\tmethod: \"POST\",\n\t\tmode: \"cors\",\n\t\tcredentials: \"same-origin\",\n\t\t// Add a special header which tells the server that we want the raw\n\t\t// error response (if applicable) rather than the reloaded page that you\n\t\t// would get if submitting a page without javascript\n\t\theaders: {\n\t\t\t\"x-torpor-form-submit\": \"\",\n\t\t},\n\t};\n\tconst response = await fetch(\n\t\taction,\n\t\t// @ts-ignore -- don't know what it's complaining about here\n\t\toptions,\n\t);\n\n\tif (response.status === 200 && response.headers.has(\"x-torpor-form-redirect\")) {\n\t\t// TODO: Should do the correct type of redirect e.g. seeOther etc\n\t\tconst redirect = response.headers.get(\"location\")!;\n\t\tawait load(redirect);\n\t\twindow.location.href = redirect;\n\t} else if (\n\t\t(response.status >= 200 && response.status <= 299) ||\n\t\t(response.status >= 400 && response.status <= 499)\n\t) {\n\t\t// Put the response into `$page.form`, and it will be put into `$props` in reload\n\t\tif (response.headers.get(\"content-type\") === \"application/json\") {\n\t\t\t$page.form = await response.json();\n\t\t}\n\t\tawait reload();\n\t}\n}\n","import client from \"../state/client\";\nimport type LayoutPath from \"../types/LayoutPath\";\nimport type PageEndPoint from \"../types/PageEndPoint\";\nimport type PageServerEndPoint from \"../types/PageServerEndPoint\";\nimport type RouteHandler from \"../types/RouteHandler\";\n\nexport default async function loadData(\n\thandler: RouteHandler,\n\tparams: Record<string, string>,\n\tpath: string,\n\tquery: URLSearchParams,\n\tnewLayoutStack: LayoutPath[],\n\tclientEndPoint: PageEndPoint | undefined,\n\tserverEndPoint: PageServerEndPoint | undefined,\n\tprefetch = false,\n): Promise<Record<string, string> | void> {\n\tlet data = {};\n\tif (handler.layouts) {\n\t\tlet layoutStack = client.layoutStack;\n\t\tfor (let [i, layout] of handler.layouts.entries()) {\n\t\t\tlet layoutPath = layout.path;\n\t\t\tfor (let key in params) {\n\t\t\t\tlayoutPath = layoutPath.replace(`[${key}]`, params[key]);\n\t\t\t}\n\t\t\tif (layoutStack.at(i)?.path === layoutPath) {\n\t\t\t\t// We've already loaded this layout, we can just re-use its data and UI\n\t\t\t\tif (!prefetch) {\n\t\t\t\t\tlayoutStack[i].reuse = true;\n\t\t\t\t}\n\t\t\t\tnewLayoutStack[i] = layoutStack[i];\n\t\t\t\tObject.assign(data, layoutStack[i].data);\n\t\t\t} else {\n\t\t\t\tconst stackLayout = { path: layoutPath, data: {}, reuse: false, slotRegion: null };\n\t\t\t\tconst layoutEndPoint: PageEndPoint | undefined = (await layout.endPoint())?.default;\n\t\t\t\tconst layoutServerEndPoint: PageServerEndPoint | undefined =\n\t\t\t\t\tlayout.serverEndPoint && (await layout.serverEndPoint())?.default;\n\t\t\t\tconst layoutResponse = await loadClientAndServerData(\n\t\t\t\t\tstackLayout.data,\n\t\t\t\t\tdocument.location.origin + layoutPath,\n\t\t\t\t\tquery,\n\t\t\t\t\tparams,\n\t\t\t\t\tlayoutEndPoint,\n\t\t\t\t\tlayoutServerEndPoint,\n\t\t\t\t);\n\t\t\t\tif (layoutResponse?.ok === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tObject.assign(data, stackLayout.data);\n\t\t\t\tnewLayoutStack.push(stackLayout);\n\t\t\t}\n\t\t}\n\t}\n\tlet endPointResponse = await loadClientAndServerData(\n\t\tdata,\n\t\tdocument.location.origin + path,\n\t\tquery,\n\t\tparams,\n\t\tclientEndPoint,\n\t\tserverEndPoint,\n\t);\n\tif (endPointResponse?.ok === false) {\n\t\treturn;\n\t}\n\treturn data;\n}\n\nasync function loadClientAndServerData(\n\tdata: Record<string, any>,\n\tlocation: string,\n\tquery: URLSearchParams,\n\tparams: Record<string, string>,\n\tclientEndPoint?: PageEndPoint,\n\tserverEndPoint?: PageServerEndPoint,\n): Promise<Response | undefined | void> {\n\tlet prefetchedData = client.prefetchedData;\n\n\tif (clientEndPoint?.load) {\n\t\tconst clientKey = location + (query.size > 0 ? `?${query}` : \"\");\n\t\tif (prefetchedData[clientKey]) {\n\t\t\tObject.assign(data, prefetchedData[clientKey]);\n\t\t} else {\n\t\t\tconst clientUrl = new URL(document.location.href);\n\t\t\tfor (let [name, value] of query) {\n\t\t\t\tclientUrl.searchParams.append(name, value);\n\t\t\t}\n\t\t\tconst clientParams = buildClientParams(clientUrl, params, data);\n\t\t\tconst clientResponse = await clientEndPoint.load(clientParams);\n\t\t\tif (clientResponse) {\n\t\t\t\tif (clientResponse.ok) {\n\t\t\t\t\tif (clientResponse.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\t\t\tconst clientData = await clientResponse.json();\n\t\t\t\t\t\tObject.assign(data, clientData);\n\t\t\t\t\t\tprefetchedData[clientKey] = clientData;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn clientResponse;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (serverEndPoint?.load) {\n\t\tconst serverLocation = location.replace(/\\/$/, \"\") + \"/~server\";\n\t\tconst serverKey = serverLocation + (query.size > 0 ? `?${query}` : \"\");\n\t\tif (prefetchedData[serverKey]) {\n\t\t\tObject.assign(data, prefetchedData[serverKey]);\n\t\t} else {\n\t\t\tconst serverUrl = new URL(serverLocation);\n\t\t\tfor (let [name, value] of query) {\n\t\t\t\tserverUrl.searchParams.append(name, value);\n\t\t\t}\n\t\t\tconst serverResponse = await fetch(serverUrl);\n\t\t\tif (serverResponse) {\n\t\t\t\tif (serverResponse.ok) {\n\t\t\t\t\tif (serverResponse.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\t\t\tconst serverData = await serverResponse.json();\n\t\t\t\t\t\tObject.assign(data, serverData);\n\t\t\t\t\t\tprefetchedData[serverKey] = serverData;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn serverResponse;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction buildClientParams(url: URL, params: Record<string, string>, data: Record<string, any>) {\n\treturn {\n\t\turl,\n\t\tparams,\n\t\tdata,\n\t};\n}\n","import { clearLayoutSlot, fillLayoutSlot, hydrate } from \"@torpor/view\";\nimport { type Component, type SlotRender } from \"@torpor/view\";\nimport { mount } from \"@torpor/view\";\nimport $page from \"../state/$page\";\nimport client from \"../state/client\";\nimport type LayoutPath from \"../types/LayoutPath\";\nimport type PageEndPoint from \"../types/PageEndPoint\";\nimport type PageServerEndPoint from \"../types/PageServerEndPoint\";\nimport formSubmit from \"./formSubmit\";\nimport loadData from \"./loadData\";\n\n// @ts-ignore\nexport default async function navigate(url: URL, withHydration = false): Promise<boolean> {\n\tlet parent = document.getElementById(\"app\");\n\tif (!parent) {\n\t\t// TODO: 500\n\t\tconsole.log(\"500\");\n\t\treturn false;\n\t}\n\n\tconst path = url.pathname;\n\tconst query = url.searchParams;\n\n\t//console.log(`navigating to '${path}'${query.size ? ` with ${query}` : \"\"}`);\n\n\tconst route = client.router.match(path, query);\n\tif (!route) {\n\t\t// TODO: 404\n\t\tconsole.log(\"404\");\n\t\treturn false;\n\t}\n\n\t// Update $page before building the components\n\t$page.url = url;\n\tif (path.endsWith(\"/_error\")) {\n\t\t$page.status = parseInt(query.get(\"status\") ?? \"404\");\n\t\t$page.error = { message: query.get(\"message\") ?? \"\" };\n\t\t// Make it look a bit classier by removing the query\n\t\twindow.history.replaceState({}, \"\", url.toString().split(\"?\")[0]);\n\t} else {\n\t\t$page.status = 200;\n\t}\n\tconst handler = route.handler;\n\tconst params = route.params || {};\n\n\t// There must be a client endpoint with a component\n\tconst clientEndPoint: PageEndPoint | undefined = (await handler.endPoint()).default;\n\tif (!clientEndPoint?.component) {\n\t\t// TODO: 404\n\t\tconsole.log(\"404\");\n\t\treturn false;\n\t}\n\n\t// There may be a server endpoint\n\tconst serverEndPoint: PageServerEndPoint | undefined =\n\t\thandler.serverEndPoint && (await handler.serverEndPoint())?.default;\n\n\tlet newLayoutStack: LayoutPath[] = [];\n\n\t// Pass the data into $props\n\t// TODO: Don't load if this is the first time -- it should have been passed\n\t// to us, somehow...\n\tconst data = await loadData(\n\t\thandler,\n\t\tparams,\n\t\tpath,\n\t\tquery,\n\t\tnewLayoutStack,\n\t\tclientEndPoint,\n\t\tserverEndPoint,\n\t);\n\t// We may have form data in a hidden input -- not sure if this is the best\n\t// way to do it\n\tlet formInput = document.getElementById(\"t-form-data\") as HTMLInputElement;\n\tlet form: Record<string, string> | undefined;\n\tif (formInput) {\n\t\tform = JSON.parse(formInput.value);\n\t\t$page.form = form;\n\t\tformInput.remove();\n\t}\n\tlet $props: Record<string, any> = { data };\n\n\t// We may have form data in $page.form, either from the hidden input\n\t// (above), or added via onformsubmit (below)\n\t$props.form = $page.form;\n\n\t// Add some special context for submitting Forms client-side\n\tconst $context = {\n\t\tTorporBuildContext: { onformsubmit: formSubmit },\n\t};\n\n\tclient.layoutStack.push({ path: route.handler.path, data: {}, reuse: false, slotRegion: null });\n\tclient.layoutStack = newLayoutStack;\n\tlet layoutStack = client.layoutStack;\n\n\t// If there are layouts, work our way upwards, pushing each component into\n\t// the default slot of its parent\n\t// TODO: There's probably a nicer way to do this with reducers or something\n\tlet component = clientEndPoint.component as Component;\n\tlet slots: Record<string, SlotRender> | undefined = undefined;\n\tif (handler.layouts) {\n\t\tlet slotFunctions: SlotRender[] = [];\n\t\t// The last slot function will render the client component\n\t\tslotFunctions[handler.layouts.length] = function clientComponent(parent, anchor) {\n\t\t\tlet i = layoutStack.length - 1;\n\t\t\tlayoutStack[i].slotRegion = fillLayoutSlot(\n\t\t\t\tclientEndPoint.component!,\n\t\t\t\tslotFunctions[i + 1],\n\t\t\t\tparent,\n\t\t\t\tanchor,\n\t\t\t\t$props,\n\t\t\t\t$context,\n\t\t\t);\n\t\t};\n\n\t\t// Each earlier slot function will render a layout\n\t\tfor (let i = handler.layouts.length - 1; i >= 0; i--) {\n\t\t\tconst layoutEndPoint: PageEndPoint | undefined = (await handler.layouts[i].endPoint())\n\t\t\t\t?.default;\n\t\t\tif (layoutEndPoint?.component) {\n\t\t\t\tif (layoutStack[i].reuse) {\n\t\t\t\t\t// Set the parent to add the new content to (from the old\n\t\t\t\t\t// content), clear the range under this point, and set the\n\t\t\t\t\t// component to the slot function within this layout\n\t\t\t\t\tparent = layoutStack[i].slotRegion.startNode.parentNode as HTMLElement;\n\t\t\t\t\tclearLayoutSlot(layoutStack[i].slotRegion);\n\t\t\t\t\tcomponent = slotFunctions[i + 1];\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i === 0) {\n\t\t\t\t\tcomponent = layoutEndPoint.component as Component;\n\t\t\t\t\tslots = { _: slotFunctions[i + 1] };\n\t\t\t\t} else {\n\t\t\t\t\tslotFunctions[i] = function layoutComponent(parent, anchor, _, $context) {\n\t\t\t\t\t\tlayoutStack[i - 1].slotRegion = fillLayoutSlot(\n\t\t\t\t\t\t\tlayoutEndPoint.component!,\n\t\t\t\t\t\t\tslotFunctions[i + 1],\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t$props,\n\t\t\t\t\t\t\t$context,\n\t\t\t\t\t\t);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (withHydration) {\n\t\thydrate(parent, component, $props, slots);\n\t} else {\n\t\ttry {\n\t\t\tmount(parent, component, $props, slots);\n\t\t} catch (error) {\n\t\t\t// TODO: Show a proper Error component\n\t\t\tparent.innerHTML = '<span style=\"color: red\">Script syntax error</span><p>' + error + \"</p>\";\n\t\t\tconsole.log(error);\n\t\t}\n\t}\n\n\t// Reset prefetched data on each navigation\n\tclient.prefetchedData = {};\n\n\treturn true;\n}\n","import navigate from \"./navigate\";\n\n/**\n * Loads and renders the page at the supplied path.\n */\nexport default async function load(path: string): Promise<boolean> {\n\tconst url = new URL(path, document.location.href);\n\treturn await navigate(url);\n}\n"],"mappings":";;;;AAEA,MAAMA,gBAA+B,OAAO,IAAI,iBAAiB;AAEjE,MAAMC,SAEJ,WAAW,mBAAmB;CAE9B,QAAQ;CACR,aAAa,EAAE;CAEf,gBAAgB,EAAE;CAClB;AAEF,qBAAe;;;;;;;ACTf,eAA8B,SAA2B;AAExD,QAAO,MAAM,SADD,IAAI,IAAI,SAAS,SAAS,KAAK,CACjB;;;;;ACH3B,eAA8B,WAAW,GAA+B;AAEvE,GAAE,gBAAgB;AAIlB,eAAM,OAAO;CAGb,MAAM,OAAO,EAAE;CACf,MAAM,SAAU,EAAE,WAAiC,cAAc,KAAK;CACtE,MAAM,UAAU;EACf,MAAM,IAAI,SAAS,KAAK;EACxB,QAAQ;EACR,MAAM;EACN,aAAa;EAIb,SAAS,EACR,wBAAwB,IACxB;EACD;CACD,MAAM,WAAW,MAAM,MACtB,QAEA,QACA;AAED,KAAI,SAAS,WAAW,OAAO,SAAS,QAAQ,IAAI,yBAAyB,EAAE;EAE9E,MAAM,WAAW,SAAS,QAAQ,IAAI,WAAW;AACjD,QAAM,KAAK,SAAS;AACpB,SAAO,SAAS,OAAO;YAEtB,SAAS,UAAU,OAAO,SAAS,UAAU,OAC7C,SAAS,UAAU,OAAO,SAAS,UAAU,KAC7C;AAED,MAAI,SAAS,QAAQ,IAAI,eAAe,KAAK,mBAC5C,eAAM,OAAO,MAAM,SAAS,MAAM;AAEnC,QAAM,QAAQ;;;;;;ACxChB,eAA8B,SAC7B,SACA,QACA,MACA,O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AAY,GAAG,aAAa,eAC3B,eAAe,WACf,cAAc,IAAI,IAClBC,UACA,QACA,QACA,SACA;;AAIF,OAAK,IAAI,IAAI,QAAQ,QAAQ,SAAS,GAAG,KAAK,GAAG,KAAK;GACrD,MAAMC,kBAA4C,MAAM,QAAQ,QAAQ,GAAG,UAAU,GAClF;AACH,OAAI,gBAAgB,UACnB,KAAI,YAAY,GAAG,OAAO;AAIzB,aAAS,YAAY,GAAG,WAAW,UAAU;AAC7C,oBAAgB,YAAY,GAAG,WAAW;AAC1C,gBAAY,cAAc,IAAI;AAC9B;cACU,MAAM,GAAG;AACnB,gBAAY,eAAe;AAC3B,YAAQ,EAAE,GAAG,cAAc,IAAI,IAAI;SAEnC,eAAc,KAAK,SAAS,gBAAgB,UAAQ,QAAQ,GAAG,YAAU;AACxE,gBAAY,IAAI,GAAG,aAAa,eAC/B,eAAe,WACf,cAAc,IAAI,IAClBD,UACA,QACA,QACAE,WACA;;;;AAON,KAAI,cACH,SAAQ,QAAQ,WAAW,QAAQ,MAAM;KAEzC,KAAI;AACH,QAAM,QAAQ,WAAW,QAAQ,MAAM;UAC/B,OAAO;AAEf,SAAO,YAAY,6DAA2D,QAAQ;AACtF,UAAQ,IAAI,MAAM;;AAKpB,gBAAO,iBAAiB,EAAE;AAE1B,QAAO;;;;;;;;AC7JR,eAA8B,KAAK,MAAgC;AAElE,QAAO,MAAM,SADD,IAAI,IAAI,MAAM,SAAS,SAAS,KAAK,CACvB"}
|
|
1
|
+
{"version":3,"file":"nav.mjs","names":["CLIENT_SYMBOL: unique symbol","client: ClientState","client","layoutEndPoint: PageEndPoint | undefined","layoutServerEndPoint: PageServerEndPoint | undefined","client","clientEndPoint: PageEndPoint | undefined","serverEndPoint: PageServerEndPoint | undefined","newLayoutStack: LayoutPath[]","form: Record<string, string> | undefined","$props: Record<string, any>","$page","slots: Record<string, SlotRender> | undefined","slotFunctions: SlotRender[]","parent","layoutEndPoint: PageEndPoint | undefined","$context"],"sources":["../src/state/client.ts","../src/nav/reload.ts","../src/nav/formSubmit.ts","../src/nav/loadData.ts","../src/nav/navigate.ts","../src/nav/load.ts"],"sourcesContent":["import type ClientState from \"../types/ClientState\";\n\nconst CLIENT_SYMBOL: unique symbol = Symbol.for(\"t_client_state\");\n\nconst client: ClientState =\n\t// @ts-ignore\n\t(globalThis[CLIENT_SYMBOL] ??= {\n\t\t// @ts-ignore This will definitely, 100% get set\n\t\trouter: null,\n\t\tlayoutStack: [],\n\t\t// TODO: Probably expire after 30 seconds or something?\n\t\tprefetchedData: {},\n\t});\n\nexport default client;\n","import navigate from \"./navigate\";\n\n/**\n * Reloads data for the currently loaded page and rerenders it.\n */\nexport default async function reload(): Promise<boolean> {\n\tconst url = new URL(document.location.href);\n\treturn await navigate(url);\n}\n","import $page from \"../state/$page\";\nimport load from \"./load\";\nimport reload from \"./reload\";\n\nexport default async function formSubmit(e: SubmitEvent): Promise<void> {\n\t// We'll take it from here\n\te.preventDefault();\n\n\t// Reset $page on submit and link navigation\n\t// TODO: Should we put data in $page.data??\n\t$page.form = undefined;\n\n\t// Perform a POST fetch to the form's action location\n\tconst form = e.target as HTMLFormElement;\n\tconst button = e.submitter as HTMLButtonElement;\n\t// HACK: submit buttons have their formAction set to the current page if not\n\t// set, so we can't just check whether it's empty and fallback to form action\n\t//const action = button?.formAction ?? form.action;\n\tlet action = form.action || document.URL;\n\tif (button && button.formAction && button.formAction !== document.URL) {\n\t\taction = button.formAction;\n\t}\n\tconst options = {\n\t\tbody: new FormData(form),\n\t\tmethod: \"POST\",\n\t\tmode: \"cors\",\n\t\tcredentials: \"same-origin\",\n\t\t// Add a special header which tells the server that we want the raw\n\t\t// error response (if applicable) rather than the reloaded page that you\n\t\t// would get if submitting a page without javascript\n\t\theaders: {\n\t\t\t\"x-torpor-form-submit\": \"\",\n\t\t},\n\t};\n\tconst response = await fetch(\n\t\taction,\n\t\t// @ts-ignore -- don't know what it's complaining about here\n\t\toptions,\n\t);\n\n\tif (response.status === 200 && response.headers.has(\"x-torpor-form-redirect\")) {\n\t\t// TODO: Should do the correct type of redirect e.g. seeOther etc\n\t\tconst redirect = response.headers.get(\"location\")!;\n\t\tawait load(redirect);\n\t\twindow.location.href = redirect;\n\t} else if (\n\t\t(response.status >= 200 && response.status <= 299) ||\n\t\t(response.status >= 400 && response.status <= 499)\n\t) {\n\t\t// Put the response into `$page.form`, and it will be put into `$props` in reload\n\t\tif (response.headers.get(\"content-type\") === \"application/json\") {\n\t\t\t$page.form = await response.json();\n\t\t}\n\t\tawait reload();\n\t}\n}\n","import client from \"../state/client\";\nimport type LayoutPath from \"../types/LayoutPath\";\nimport type PageEndPoint from \"../types/PageEndPoint\";\nimport type PageServerEndPoint from \"../types/PageServerEndPoint\";\nimport type RouteHandler from \"../types/RouteHandler\";\n\nexport default async function loadData(\n\thandler: RouteHandler,\n\tparams: Record<string, string>,\n\tpath: string,\n\tquery: URLSearchParams,\n\tnewLayoutStack: LayoutPath[],\n\tclientEndPoint: PageEndPoint | undefined,\n\tserverEndPoint: PageServerEndPoint | undefined,\n\tprefetch = false,\n): Promise<Record<string, string> | void> {\n\tlet data = {};\n\tif (handler.layouts) {\n\t\tlet layoutStack = client.layoutStack;\n\t\tfor (let [i, layout] of handler.layouts.entries()) {\n\t\t\tlet layoutPath = layout.path;\n\t\t\tfor (let key in params) {\n\t\t\t\tlayoutPath = layoutPath.replace(`[${key}]`, params[key]);\n\t\t\t}\n\t\t\tif (layoutStack.at(i)?.path === layoutPath) {\n\t\t\t\t// We've already loaded this layout, we can just re-use its data and UI\n\t\t\t\tif (!prefetch) {\n\t\t\t\t\tlayoutStack[i].reuse = true;\n\t\t\t\t}\n\t\t\t\tnewLayoutStack[i] = layoutStack[i];\n\t\t\t\tObject.assign(data, layoutStack[i].data);\n\t\t\t} else {\n\t\t\t\tconst stackLayout = { path: layoutPath, data: {}, reuse: false, slotRegion: null };\n\t\t\t\tconst layoutEndPoint: PageEndPoint | undefined = (await layout.endPoint())?.default;\n\t\t\t\tconst layoutServerEndPoint: PageServerEndPoint | undefined =\n\t\t\t\t\tlayout.serverEndPoint && (await layout.serverEndPoint())?.default;\n\t\t\t\tconst layoutResponse = await loadClientAndServerData(\n\t\t\t\t\tstackLayout.data,\n\t\t\t\t\tdocument.location.origin + layoutPath,\n\t\t\t\t\tquery,\n\t\t\t\t\tparams,\n\t\t\t\t\tlayoutEndPoint,\n\t\t\t\t\tlayoutServerEndPoint,\n\t\t\t\t);\n\t\t\t\tif (layoutResponse?.ok === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tObject.assign(data, stackLayout.data);\n\t\t\t\tnewLayoutStack.push(stackLayout);\n\t\t\t}\n\t\t}\n\t}\n\tlet endPointResponse = await loadClientAndServerData(\n\t\tdata,\n\t\tdocument.location.origin + path,\n\t\tquery,\n\t\tparams,\n\t\tclientEndPoint,\n\t\tserverEndPoint,\n\t);\n\tif (endPointResponse?.ok === false) {\n\t\treturn;\n\t}\n\treturn data;\n}\n\nasync function loadClientAndServerData(\n\tdata: Record<string, any>,\n\tlocation: string,\n\tquery: URLSearchParams,\n\tparams: Record<string, string>,\n\tclientEndPoint?: PageEndPoint,\n\tserverEndPoint?: PageServerEndPoint,\n): Promise<Response | undefined | void> {\n\tlet prefetchedData = client.prefetchedData;\n\n\tif (clientEndPoint?.load) {\n\t\tconst clientKey = location + (query.size > 0 ? `?${query}` : \"\");\n\t\tif (prefetchedData[clientKey]) {\n\t\t\tObject.assign(data, prefetchedData[clientKey]);\n\t\t} else {\n\t\t\tconst clientUrl = new URL(document.location.href);\n\t\t\tfor (let [name, value] of query) {\n\t\t\t\tclientUrl.searchParams.append(name, value);\n\t\t\t}\n\t\t\tconst clientParams = buildClientParams(clientUrl, params, data);\n\t\t\tconst clientResponse = await clientEndPoint.load(clientParams);\n\t\t\tif (clientResponse) {\n\t\t\t\tif (clientResponse.ok) {\n\t\t\t\t\tif (clientResponse.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\t\t\tconst clientData = await clientResponse.json();\n\t\t\t\t\t\tObject.assign(data, clientData);\n\t\t\t\t\t\tprefetchedData[clientKey] = clientData;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn clientResponse;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (serverEndPoint?.load) {\n\t\tconst serverLocation = location.replace(/\\/$/, \"\") + \"/~server\";\n\t\tconst serverKey = serverLocation + (query.size > 0 ? `?${query}` : \"\");\n\t\tif (prefetchedData[serverKey]) {\n\t\t\tObject.assign(data, prefetchedData[serverKey]);\n\t\t} else {\n\t\t\tconst serverUrl = new URL(serverLocation);\n\t\t\tfor (let [name, value] of query) {\n\t\t\t\tserverUrl.searchParams.append(name, value);\n\t\t\t}\n\t\t\tconst serverResponse = await fetch(serverUrl);\n\t\t\tif (serverResponse) {\n\t\t\t\tif (serverResponse.ok) {\n\t\t\t\t\tif (serverResponse.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\t\t\tconst serverData = await serverResponse.json();\n\t\t\t\t\t\tObject.assign(data, serverData);\n\t\t\t\t\t\tprefetchedData[serverKey] = serverData;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn serverResponse;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction buildClientParams(url: URL, params: Record<string, string>, data: Record<string, any>) {\n\treturn {\n\t\turl,\n\t\tparams,\n\t\tdata,\n\t};\n}\n","import { clearLayoutSlot, fillLayoutSlot, hydrate } from \"@torpor/view\";\nimport { type Component, type SlotRender } from \"@torpor/view\";\nimport { mount } from \"@torpor/view\";\nimport $page from \"../state/$page\";\nimport client from \"../state/client\";\nimport type LayoutPath from \"../types/LayoutPath\";\nimport type PageEndPoint from \"../types/PageEndPoint\";\nimport type PageServerEndPoint from \"../types/PageServerEndPoint\";\nimport formSubmit from \"./formSubmit\";\nimport loadData from \"./loadData\";\n\n// @ts-ignore\nexport default async function navigate(url: URL, withHydration = false): Promise<boolean> {\n\tlet parent = document.getElementById(\"app\");\n\tif (!parent) {\n\t\t// TODO: 500\n\t\tconsole.log(\"500\");\n\t\treturn false;\n\t}\n\n\tconst path = url.pathname;\n\tconst query = url.searchParams;\n\n\t//console.log(`navigating to '${path}'${query.size ? ` with ${query}` : \"\"}`);\n\n\tconst route = client.router.match(path, query);\n\tif (!route) {\n\t\t// TODO: 404\n\t\tconsole.log(\"404\");\n\t\treturn false;\n\t}\n\n\t// Update $page before building the components\n\t$page.url = url;\n\tif (path.endsWith(\"/_error\")) {\n\t\t$page.status = parseInt(query.get(\"status\") ?? \"404\");\n\t\t$page.error = { message: query.get(\"message\") ?? \"\" };\n\t\t// Make it look a bit classier by removing the query\n\t\twindow.history.replaceState({}, \"\", url.toString().split(\"?\")[0]);\n\t} else {\n\t\t$page.status = 200;\n\t}\n\tconst handler = route.handler;\n\tconst params = route.params || {};\n\n\t// There must be a client endpoint with a component\n\tconst clientEndPoint: PageEndPoint | undefined = (await handler.endPoint()).default;\n\tif (!clientEndPoint?.component) {\n\t\t// TODO: 404\n\t\tconsole.log(\"404\");\n\t\treturn false;\n\t}\n\n\t// There may be a server endpoint\n\tconst serverEndPoint: PageServerEndPoint | undefined =\n\t\thandler.serverEndPoint && (await handler.serverEndPoint())?.default;\n\n\tlet newLayoutStack: LayoutPath[] = [];\n\n\t// Pass the data into $props\n\t// TODO: Don't load if this is the first time -- it should have been passed\n\t// to us, somehow...\n\tconst data = await loadData(\n\t\thandler,\n\t\tparams,\n\t\tpath,\n\t\tquery,\n\t\tnewLayoutStack,\n\t\tclientEndPoint,\n\t\tserverEndPoint,\n\t);\n\t// We may have form data in a hidden input -- not sure if this is the best\n\t// way to do it\n\tlet formInput = document.getElementById(\"t-form-data\") as HTMLInputElement;\n\tlet form: Record<string, string> | undefined;\n\tif (formInput) {\n\t\tform = JSON.parse(formInput.value);\n\t\t$page.form = form;\n\t\tformInput.remove();\n\t}\n\tlet $props: Record<string, any> = { data };\n\n\t// We may have form data in $page.form, either from the hidden input\n\t// (above), or added via onformsubmit (below)\n\t$props.form = $page.form;\n\n\t// Add some special context for submitting Forms client-side\n\tconst $context = {\n\t\tTorporBuildContext: { onformsubmit: formSubmit },\n\t};\n\n\tclient.layoutStack.push({ path: route.handler.path, data: {}, reuse: false, slotRegion: null });\n\tclient.layoutStack = newLayoutStack;\n\tlet layoutStack = client.layoutStack;\n\n\t// If there are layouts, work our way upwards, pushing each component into\n\t// the default slot of its parent\n\t// TODO: There's probably a nicer way to do this with reducers or something\n\tlet component = clientEndPoint.component as Component;\n\tlet slots: Record<string, SlotRender> | undefined = undefined;\n\tif (handler.layouts) {\n\t\tlet slotFunctions: SlotRender[] = [];\n\t\t// The last slot function will render the client component\n\t\tslotFunctions[handler.layouts.length] = function clientComponent(parent, anchor) {\n\t\t\tlet i = layoutStack.length - 1;\n\t\t\tlayoutStack[i].slotRegion = fillLayoutSlot(\n\t\t\t\tclientEndPoint.component!,\n\t\t\t\tslotFunctions[i + 1],\n\t\t\t\tparent,\n\t\t\t\tanchor,\n\t\t\t\t$props,\n\t\t\t\t$context,\n\t\t\t);\n\t\t};\n\n\t\t// Each earlier slot function will render a layout\n\t\tfor (let i = handler.layouts.length - 1; i >= 0; i--) {\n\t\t\tconst layoutEndPoint: PageEndPoint | undefined = (await handler.layouts[i].endPoint())\n\t\t\t\t?.default;\n\t\t\tif (layoutEndPoint?.component) {\n\t\t\t\tif (layoutStack[i].reuse) {\n\t\t\t\t\t// Set the parent to add the new content to (from the old\n\t\t\t\t\t// content), clear the range under this point, and set the\n\t\t\t\t\t// component to the slot function within this layout\n\t\t\t\t\tparent = layoutStack[i].slotRegion.startNode.parentNode as HTMLElement;\n\t\t\t\t\tclearLayoutSlot(layoutStack[i].slotRegion);\n\t\t\t\t\tcomponent = slotFunctions[i + 1];\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (i === 0) {\n\t\t\t\t\tcomponent = layoutEndPoint.component as Component;\n\t\t\t\t\tslots = { _: slotFunctions[i + 1] };\n\t\t\t\t} else {\n\t\t\t\t\tslotFunctions[i] = function layoutComponent(parent, anchor, _, $context) {\n\t\t\t\t\t\tlayoutStack[i - 1].slotRegion = fillLayoutSlot(\n\t\t\t\t\t\t\tlayoutEndPoint.component!,\n\t\t\t\t\t\t\tslotFunctions[i + 1],\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t$props,\n\t\t\t\t\t\t\t$context,\n\t\t\t\t\t\t);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (withHydration) {\n\t\thydrate(parent, component, $props, slots);\n\t} else {\n\t\ttry {\n\t\t\tmount(parent, component, $props, slots);\n\t\t} catch (error) {\n\t\t\t// TODO: Show a proper Error component\n\t\t\tparent.innerHTML = '<span style=\"color: red\">Script syntax error</span><p>' + error + \"</p>\";\n\t\t\tconsole.log(error);\n\t\t}\n\t}\n\n\t// Reset prefetched data on each navigation\n\tclient.prefetchedData = {};\n\n\treturn true;\n}\n","import navigate from \"./navigate\";\n\n/**\n * Loads and renders the page at the supplied path.\n */\nexport default async function load(path: string): Promise<boolean> {\n\tconst url = new URL(path, document.location.href);\n\treturn await navigate(url);\n}\n"],"mappings":";;;;AAEA,MAAMA,gBAA+B,OAAO,IAAI,iBAAiB;AAEjE,MAAMC,SAEJ,WAAW,mBAAmB;CAE9B,QAAQ;CACR,aAAa,EAAE;CAEf,gBAAgB,EAAE;CAClB;AAEF,qBAAe;;;;;;;ACTf,eAA8B,SAA2B;AAExD,QAAO,MAAM,SADD,IAAI,IAAI,SAAS,SAAS,KAAK,CACjB;;;;;ACH3B,eAA8B,WAAW,GAA+B;AAEvE,GAAE,gBAAgB;AAIlB,eAAM,OAAO;CAGb,MAAM,OAAO,EAAE;CACf,MAAM,SAAS,EAAE;CAIjB,IAAI,SAAS,KAAK,UAAU,SAAS;AACrC,KAAI,UAAU,OAAO,cAAc,OAAO,eAAe,SAAS,IACjE,UAAS,OAAO;CAE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/B,OAAO;AAEf,SAAO,YAAY,6DAA2D,QAAQ;AACtF,UAAQ,IAAI,MAAM;;AAKpB,gBAAO,iBAAiB,EAAE;AAE1B,QAAO;;;;;;;;AC7JR,eAA8B,KAAK,MAAgC;AAElE,QAAO,MAAM,SADD,IAAI,IAAI,MAAM,SAAS,SAAS,KAAK,CACvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@torpor/build",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "A framework for building sites and apps with Torpor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./src/types/manifest.d.ts"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"./src/types/manifest.d.ts"
|
|
42
|
+
],
|
|
39
43
|
"publishConfig": {
|
|
40
44
|
"access": "public"
|
|
41
45
|
},
|
|
@@ -50,8 +54,8 @@
|
|
|
50
54
|
"dotenv": "^17.2.3",
|
|
51
55
|
"vite": "^7.2.2",
|
|
52
56
|
"vite-tsconfig-paths": "^5.1.4",
|
|
53
|
-
"@torpor/
|
|
54
|
-
"@torpor/
|
|
57
|
+
"@torpor/view": "^0.4.16",
|
|
58
|
+
"@torpor/unplugin": "^0.2.1"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
# @torpor/build
|
|
2
|
-
|
|
3
|
-
## 0.4.8
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- d813c86: Fix: pass search params to client side data cache
|
|
8
|
-
|
|
9
|
-
## 0.4.7
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- a09c14e: Fix: bad bin script
|
|
14
|
-
|
|
15
|
-
## 0.4.6
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- cf8d8db: Fix: pass search params to client side navigation
|
|
20
|
-
- 64adf0b: Feat: `subFolder` option when adding routes
|
|
21
|
-
- Updated dependencies [9bca98e]
|
|
22
|
-
- Updated dependencies [7382b6d]
|
|
23
|
-
- Updated dependencies [d68d347]
|
|
24
|
-
- Updated dependencies [4e3d726]
|
|
25
|
-
- Updated dependencies [adfa504]
|
|
26
|
-
- @torpor/view@0.4.14
|
|
27
|
-
|
|
28
|
-
## 0.4.5
|
|
29
|
-
|
|
30
|
-
### Patch Changes
|
|
31
|
-
|
|
32
|
-
- ec90aef: Fix: submit to a button's formaction if set
|
|
33
|
-
|
|
34
|
-
## 0.4.4
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- 5b12119: Fix: don't add error JSON as the message
|
|
39
|
-
- Updated dependencies [3cc2168]
|
|
40
|
-
- Updated dependencies [13f2afb]
|
|
41
|
-
- @torpor/view@0.4.7
|
|
42
|
-
|
|
43
|
-
## 0.4.3
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- 426f7bd: Fix: return default $page.form status and message
|
|
48
|
-
|
|
49
|
-
## 0.4.2
|
|
50
|
-
|
|
51
|
-
### Patch Changes
|
|
52
|
-
|
|
53
|
-
- 5dd6a23: Fix: only set $page.form if the result is JSON
|
|
54
|
-
|
|
55
|
-
## 0.4.1
|
|
56
|
-
|
|
57
|
-
### Patch Changes
|
|
58
|
-
|
|
59
|
-
- 5972cf8: Fix: ensure that $page and client are always in scope
|
|
60
|
-
- Updated dependencies [00a1868]
|
|
61
|
-
- @torpor/view@0.4.3
|
|
62
|
-
|
|
63
|
-
## 0.4.0
|
|
64
|
-
|
|
65
|
-
### Minor Changes
|
|
66
|
-
|
|
67
|
-
- 168dff3: !Edit: rename Range to Region to avoid name conflicts
|
|
68
|
-
|
|
69
|
-
### Patch Changes
|
|
70
|
-
|
|
71
|
-
- 051998b: Feat: very rudimentary dev tools
|
|
72
|
-
- Updated dependencies [255aad3]
|
|
73
|
-
- Updated dependencies [8b377a2]
|
|
74
|
-
- Updated dependencies [450b739]
|
|
75
|
-
- Updated dependencies [168dff3]
|
|
76
|
-
- Updated dependencies [fc60fe0]
|
|
77
|
-
- Updated dependencies [42c6b60]
|
|
78
|
-
- Updated dependencies [2818679]
|
|
79
|
-
- Updated dependencies [38fd0a5]
|
|
80
|
-
- Updated dependencies [3e6f3f7]
|
|
81
|
-
- Updated dependencies [051998b]
|
|
82
|
-
- @torpor/view@0.4.0
|
|
83
|
-
- @torpor/unplugin@0.2.1
|
|
84
|
-
|
|
85
|
-
## 0.3.1
|
|
86
|
-
|
|
87
|
-
### Patch Changes
|
|
88
|
-
|
|
89
|
-
- 34d17f7: Feat: UI Form component and client-side submit
|
|
90
|
-
- Updated dependencies [f4716c5]
|
|
91
|
-
- Updated dependencies [1253f7a]
|
|
92
|
-
- Updated dependencies [6268e00]
|
|
93
|
-
- Updated dependencies [f2fb547]
|
|
94
|
-
- @torpor/view@0.3.2
|
|
95
|
-
|
|
96
|
-
## 0.3.0
|
|
97
|
-
|
|
98
|
-
### Minor Changes
|
|
99
|
-
|
|
100
|
-
- 51dbba7: Chore: drop CJS build and go ESM only
|
|
101
|
-
- 62b0d2e: !Edit: renamed responses and updated documentation
|
|
102
|
-
|
|
103
|
-
### Patch Changes
|
|
104
|
-
|
|
105
|
-
- bbdc8d3: Feat: return form errors from the server
|
|
106
|
-
- e1ae2bb: Feat: load and reload methods for navigation
|
|
107
|
-
- Updated dependencies [be98b35]
|
|
108
|
-
- Updated dependencies [51dbba7]
|
|
109
|
-
- Updated dependencies [2298a87]
|
|
110
|
-
- Updated dependencies [3a8431a]
|
|
111
|
-
- Updated dependencies [eb58d37]
|
|
112
|
-
- Updated dependencies [e0637be]
|
|
113
|
-
- Updated dependencies [9fcc613]
|
|
114
|
-
- Updated dependencies [f5f84e6]
|
|
115
|
-
- Updated dependencies [6cc57ff]
|
|
116
|
-
- Updated dependencies [c4f9d18]
|
|
117
|
-
- Updated dependencies [5598bc9]
|
|
118
|
-
- Updated dependencies [18f1ccf]
|
|
119
|
-
- Updated dependencies [c2b5c02]
|
|
120
|
-
- Updated dependencies [91d1536]
|
|
121
|
-
- Updated dependencies [4dc16df]
|
|
122
|
-
- Updated dependencies [543b229]
|
|
123
|
-
- Updated dependencies [3cf3ae6]
|
|
124
|
-
- @torpor/view@0.3.0
|
|
125
|
-
- @torpor/unplugin@0.2.0
|
|
126
|
-
|
|
127
|
-
## 0.2.0
|
|
128
|
-
|
|
129
|
-
### Minor Changes
|
|
130
|
-
|
|
131
|
-
- b716d5c: Feat: inline styles during SSR
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- a4f2573: Fix: reload the page on successful form submit
|
|
136
|
-
- 67e6ca6: Fix: don't intercept external links
|
|
137
|
-
- Updated dependencies [c38f914]
|
|
138
|
-
- Updated dependencies [995d950]
|
|
139
|
-
- Updated dependencies [b716d5c]
|
|
140
|
-
- Updated dependencies [014bda0]
|
|
141
|
-
- @torpor/view@0.2.0
|
|
142
|
-
- @torpor/unplugin@0.1.17
|
|
143
|
-
|
|
144
|
-
## 0.1.34
|
|
145
|
-
|
|
146
|
-
### Patch Changes
|
|
147
|
-
|
|
148
|
-
- 1221923: Fix: updating layouts in [parameter] routes
|
|
149
|
-
- Updated dependencies [741a289]
|
|
150
|
-
- @torpor/view@0.1.11
|
|
151
|
-
|
|
152
|
-
## 0.1.33
|
|
153
|
-
|
|
154
|
-
### Patch Changes
|
|
155
|
-
|
|
156
|
-
- 74bf42d: Fix: store (and clear) the right layout slot ranges
|
|
157
|
-
- Updated dependencies [74bf42d]
|
|
158
|
-
- @torpor/view@0.1.10
|
|
159
|
-
|
|
160
|
-
## 0.1.32
|
|
161
|
-
|
|
162
|
-
### Patch Changes
|
|
163
|
-
|
|
164
|
-
- 951a86f: Feat: re-use layout data and UI
|
|
165
|
-
- 182d436: Feat: prefetching link data
|
|
166
|
-
- Updated dependencies [1866f30]
|
|
167
|
-
- Updated dependencies [a31647f]
|
|
168
|
-
- Updated dependencies [951a86f]
|
|
169
|
-
- Updated dependencies [6d6fb89]
|
|
170
|
-
- Updated dependencies [9c13f0f]
|
|
171
|
-
- @torpor/view@0.1.6
|
|
172
|
-
|
|
173
|
-
## 0.1.31
|
|
174
|
-
|
|
175
|
-
### Patch Changes
|
|
176
|
-
|
|
177
|
-
- Updated dependencies [f390b78]
|
|
178
|
-
- @torpor/view@0.1.5
|
|
179
|
-
- @torpor/unplugin@0.1.16
|
|
180
|
-
|
|
181
|
-
## 0.1.30
|
|
182
|
-
|
|
183
|
-
### Patch Changes
|
|
184
|
-
|
|
185
|
-
- Updated dependencies [daba2ad]
|
|
186
|
-
- @torpor/view@0.1.4
|
|
187
|
-
- @torpor/unplugin@0.1.15
|
|
188
|
-
|
|
189
|
-
## 0.1.29
|
|
190
|
-
|
|
191
|
-
### Patch Changes
|
|
192
|
-
|
|
193
|
-
- Updated dependencies [de51225]
|
|
194
|
-
- @torpor/view@0.1.3
|
|
195
|
-
- @torpor/unplugin@0.1.14
|
|
196
|
-
|
|
197
|
-
## 0.1.28
|
|
198
|
-
|
|
199
|
-
### Patch Changes
|
|
200
|
-
|
|
201
|
-
- fa85b57: Fix: force `.torp` file compilation in dev
|
|
202
|
-
|
|
203
|
-
## 0.1.27
|
|
204
|
-
|
|
205
|
-
### Patch Changes
|
|
206
|
-
|
|
207
|
-
- bed55d5: Feat: allow passing Vite options in dev
|
|
208
|
-
|
|
209
|
-
## 0.1.26
|
|
210
|
-
|
|
211
|
-
### Patch Changes
|
|
212
|
-
|
|
213
|
-
- 348cd75: Feat: allow creating the Site router with files
|
|
214
|
-
- Updated dependencies [0e69292]
|
|
215
|
-
- Updated dependencies [b69fde1]
|
|
216
|
-
- @torpor/view@0.1.2
|
|
217
|
-
- @torpor/unplugin@0.1.13
|
|
218
|
-
|
|
219
|
-
## 0.1.25
|
|
220
|
-
|
|
221
|
-
### Patch Changes
|
|
222
|
-
|
|
223
|
-
- 3fe0d0e: Feat: set default error messages in responses
|
|
224
|
-
- f26603f: Feat: basic error handling
|
|
225
|
-
- Updated dependencies [f9fd76d]
|
|
226
|
-
- Updated dependencies [1ddc240]
|
|
227
|
-
- Updated dependencies [7b9dc31]
|
|
228
|
-
- @torpor/view@0.1.1
|
|
229
|
-
- @torpor/unplugin@0.1.12
|
|
230
|
-
|
|
231
|
-
## 0.1.24
|
|
232
|
-
|
|
233
|
-
### Patch Changes
|
|
234
|
-
|
|
235
|
-
- 6092a91: Fix: don't swallow error responses when loading data
|
|
236
|
-
|
|
237
|
-
## 0.1.23
|
|
238
|
-
|
|
239
|
-
### Patch Changes
|
|
240
|
-
|
|
241
|
-
- 22f62d4: Fix: Site.viteConfig settings
|
|
242
|
-
|
|
243
|
-
## 0.1.22
|
|
244
|
-
|
|
245
|
-
### Patch Changes
|
|
246
|
-
|
|
247
|
-
- 4e0ec90: Feat: allow more Site.viteConfig settings
|
|
248
|
-
|
|
249
|
-
## 0.1.21
|
|
250
|
-
|
|
251
|
-
### Patch Changes
|
|
252
|
-
|
|
253
|
-
- 4296742: Feat: add Site.viteConfig to set Vite options in build
|
|
254
|
-
|
|
255
|
-
## 0.1.20
|
|
256
|
-
|
|
257
|
-
### Patch Changes
|
|
258
|
-
|
|
259
|
-
- a61f30f: Debug: double hydration
|
|
260
|
-
- Updated dependencies [28a993b]
|
|
261
|
-
- Updated dependencies [98602ec]
|
|
262
|
-
- Updated dependencies [a49d307]
|
|
263
|
-
- Updated dependencies [995513a]
|
|
264
|
-
- Updated dependencies [c9a9cf8]
|
|
265
|
-
- Updated dependencies [cbd07ca]
|
|
266
|
-
- Updated dependencies [f53b184]
|
|
267
|
-
- Updated dependencies [215db17]
|
|
268
|
-
- Updated dependencies [95e866b]
|
|
269
|
-
- @torpor/unplugin@0.1.11
|
|
270
|
-
- @torpor/view@0.1.0
|
|
271
|
-
|
|
272
|
-
## 0.1.19
|
|
273
|
-
|
|
274
|
-
### Patch Changes
|
|
275
|
-
|
|
276
|
-
- 170c886: Debug: double hydration
|
|
277
|
-
|
|
278
|
-
## 0.1.18
|
|
279
|
-
|
|
280
|
-
### Patch Changes
|
|
281
|
-
|
|
282
|
-
- Updated dependencies [fb896c6]
|
|
283
|
-
- Updated dependencies [85bccf6]
|
|
284
|
-
- @torpor/view@0.0.14
|
|
285
|
-
- @torpor/unplugin@0.1.10
|
|
286
|
-
|
|
287
|
-
## 0.1.17
|
|
288
|
-
|
|
289
|
-
### Patch Changes
|
|
290
|
-
|
|
291
|
-
- 7373f27: Fix: parse the cookie value retrieved from the map
|
|
292
|
-
- 679a448: Fix: set $page props on every navigation
|
|
293
|
-
- e5b761b: Feat: allow passing ServerEvent to runTest
|
|
294
|
-
- Updated dependencies [ed4a6db]
|
|
295
|
-
- @torpor/view@0.0.13
|
|
296
|
-
- @torpor/unplugin@0.1.9
|
|
297
|
-
|
|
298
|
-
## 0.1.16
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
- 9332635: Fix: set $page props in the correct object
|
|
303
|
-
- Updated dependencies [ff5f459]
|
|
304
|
-
- @torpor/view@0.0.12
|
|
305
|
-
- @torpor/unplugin@0.1.8
|
|
306
|
-
|
|
307
|
-
## 0.1.15
|
|
308
|
-
|
|
309
|
-
### Patch Changes
|
|
310
|
-
|
|
311
|
-
- Updated dependencies [e4060e6]
|
|
312
|
-
- @torpor/unplugin@0.1.7
|
|
313
|
-
|
|
314
|
-
## 0.1.14
|
|
315
|
-
|
|
316
|
-
### Patch Changes
|
|
317
|
-
|
|
318
|
-
- e395c9e: Feat: rudimentary test infrastructure
|
|
319
|
-
- Updated dependencies [5676a0b]
|
|
320
|
-
- @torpor/unplugin@0.1.6
|
|
321
|
-
|
|
322
|
-
## 0.1.13
|
|
323
|
-
|
|
324
|
-
### Patch Changes
|
|
325
|
-
|
|
326
|
-
- 02eac8e: Feat: allow passing extra inputs to build
|
|
327
|
-
|
|
328
|
-
## 0.1.12
|
|
329
|
-
|
|
330
|
-
### Patch Changes
|
|
331
|
-
|
|
332
|
-
- 8de094b: Fix: ignore trailing slashes when matching routes
|
|
333
|
-
|
|
334
|
-
## 0.1.11
|
|
335
|
-
|
|
336
|
-
### Patch Changes
|
|
337
|
-
|
|
338
|
-
- 858538b: Fix: move adapter to globalThis, pass it to server loads
|
|
339
|
-
|
|
340
|
-
## 0.1.10
|
|
341
|
-
|
|
342
|
-
### Patch Changes
|
|
343
|
-
|
|
344
|
-
- Updated dependencies [78e78b9]
|
|
345
|
-
- @torpor/view@0.0.11
|
|
346
|
-
- @torpor/unplugin@0.1.5
|
|
347
|
-
|
|
348
|
-
## 0.1.9
|
|
349
|
-
|
|
350
|
-
### Patch Changes
|
|
351
|
-
|
|
352
|
-
- ff685cb: Fix: use the existing fragment name
|
|
353
|
-
|
|
354
|
-
## 0.1.8
|
|
355
|
-
|
|
356
|
-
### Patch Changes
|
|
357
|
-
|
|
358
|
-
- fe7444e: Refactor: rearrange build exports
|
|
359
|
-
- Updated dependencies [8852c89]
|
|
360
|
-
- @torpor/unplugin@0.1.4
|
|
361
|
-
|
|
362
|
-
## 0.1.7
|
|
363
|
-
|
|
364
|
-
### Patch Changes
|
|
365
|
-
|
|
366
|
-
- Updated dependencies [3cf6de6]
|
|
367
|
-
- @torpor/view@0.0.10
|
|
368
|
-
- @torpor/unplugin@0.1.3
|
|
369
|
-
|
|
370
|
-
## 0.1.6
|
|
371
|
-
|
|
372
|
-
### Patch Changes
|
|
373
|
-
|
|
374
|
-
- 47c5277: Chore: update dependencies
|
|
375
|
-
- Updated dependencies [47c5277]
|
|
376
|
-
- @torpor/unplugin@0.1.2
|
|
377
|
-
- @torpor/view@0.0.9
|
|
378
|
-
|
|
379
|
-
## 0.1.5
|
|
380
|
-
|
|
381
|
-
### Patch Changes
|
|
382
|
-
|
|
383
|
-
- 5c9d90f: Fix: double check server rendering from Vite options
|
|
384
|
-
- Updated dependencies [a8ead36]
|
|
385
|
-
- @torpor/view@0.0.8
|
|
386
|
-
- @torpor/unplugin@0.1.1
|
|
387
|
-
|
|
388
|
-
## 0.1.4
|
|
389
|
-
|
|
390
|
-
### Patch Changes
|
|
391
|
-
|
|
392
|
-
- 20ddf6c: Fix: better/less console.logging
|
|
393
|
-
|
|
394
|
-
## 0.1.3
|
|
395
|
-
|
|
396
|
-
### Patch Changes
|
|
397
|
-
|
|
398
|
-
- 4b86717: Refactor: separate adapters into packages
|
|
399
|
-
|
|
400
|
-
## 0.1.2
|
|
401
|
-
|
|
402
|
-
### Patch Changes
|
|
403
|
-
|
|
404
|
-
- d31d14d: Feat: allow running from code
|
|
405
|
-
|
|
406
|
-
## 0.1.1
|
|
407
|
-
|
|
408
|
-
### Patch Changes
|
|
409
|
-
|
|
410
|
-
- Updated dependencies
|
|
411
|
-
- @torpor/unplugin@0.1.0
|
|
412
|
-
|
|
413
|
-
## 0.1.0
|
|
414
|
-
|
|
415
|
-
### Minor Changes
|
|
416
|
-
|
|
417
|
-
- Chore: replace Vinxi with Vite plugins
|
|
418
|
-
|
|
419
|
-
## 0.0.6
|
|
420
|
-
|
|
421
|
-
### Patch Changes
|
|
422
|
-
|
|
423
|
-
- Updated dependencies [b90d729]
|
|
424
|
-
- @torpor/view@0.0.7
|
|
425
|
-
- @torpor/unplugin@0.0.6
|
|
426
|
-
|
|
427
|
-
## 0.0.5
|
|
428
|
-
|
|
429
|
-
### Patch Changes
|
|
430
|
-
|
|
431
|
-
- 79da6cf: Refactor: export more types
|
|
432
|
-
- 3707fdb: Fix: better ordering of routes
|
|
433
|
-
- Updated dependencies [808da4c]
|
|
434
|
-
- @torpor/view@0.0.6
|
|
435
|
-
- @torpor/unplugin@0.0.5
|
|
436
|
-
|
|
437
|
-
## 0.0.4
|
|
438
|
-
|
|
439
|
-
### Patch Changes
|
|
440
|
-
|
|
441
|
-
- Updated dependencies [44cf656]
|
|
442
|
-
- Updated dependencies [a278176]
|
|
443
|
-
- @torpor/view@0.0.5
|
|
444
|
-
- @torpor/unplugin@0.0.4
|
|
445
|
-
|
|
446
|
-
## 0.0.3
|
|
447
|
-
|
|
448
|
-
### Patch Changes
|
|
449
|
-
|
|
450
|
-
- Updated dependencies [76dd6ea]
|
|
451
|
-
- Updated dependencies [8f0a0a1]
|
|
452
|
-
- @torpor/view@0.0.4
|
|
453
|
-
- @torpor/unplugin@0.0.3
|
|
454
|
-
|
|
455
|
-
## 0.0.2
|
|
456
|
-
|
|
457
|
-
### Patch Changes
|
|
458
|
-
|
|
459
|
-
- Fix: use /~server for hooks as well as layouts
|
|
460
|
-
- Fix: catch-all routes should get checked last
|
|
461
|
-
- Updated dependencies
|
|
462
|
-
- Updated dependencies
|
|
463
|
-
- Updated dependencies
|
|
464
|
-
- Updated dependencies
|
|
465
|
-
- Updated dependencies
|
|
466
|
-
- @torpor/view@0.0.3
|
|
467
|
-
- @torpor/unplugin@0.0.2
|
package/scripts/postbuild.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { renameSync } from "node:fs";
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
// HACK: tsdown only creates *.mjs files now (post v0.16), so we need to rename
|
|
6
|
-
// the bin/index.mjs file to bin/index.js for it to be run by node
|
|
7
|
-
|
|
8
|
-
const scriptsFolder = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const distFolder = resolve(scriptsFolder, "../dist");
|
|
10
|
-
|
|
11
|
-
renameSync(join(distFolder, "bin", "index.mjs"), join(distFolder, "bin", "index.js"));
|
|
12
|
-
renameSync(join(distFolder, "bin", "index.mjs.map"), join(distFolder, "bin", "index.js.map"));
|
package/src/bin/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
import run from "../run/run";
|
|
3
|
-
|
|
4
|
-
const workingDir = process.cwd();
|
|
5
|
-
if (process.argv.includes("--dev")) {
|
|
6
|
-
await run(workingDir, "dev");
|
|
7
|
-
} else if (process.argv.includes("--build")) {
|
|
8
|
-
await run(workingDir, "build");
|
|
9
|
-
} else if (process.argv.includes("--preview")) {
|
|
10
|
-
await run(workingDir, "preview");
|
|
11
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Router from "./site/Router";
|
|
2
|
-
import Site from "./site/Site";
|
|
3
|
-
import type Adapter from "./types/Adapter";
|
|
4
|
-
import type PageEndPoint from "./types/PageEndPoint";
|
|
5
|
-
import type PageLoadEvent from "./types/PageLoadEvent";
|
|
6
|
-
import type PageServerAction from "./types/PageServerAction";
|
|
7
|
-
import type PageServerEndPoint from "./types/PageServerEndPoint";
|
|
8
|
-
import type PageServerLoad from "./types/PageServerLoad";
|
|
9
|
-
import type ServerEndPoint from "./types/ServerEndPoint";
|
|
10
|
-
import type ServerHook from "./types/ServerHook";
|
|
11
|
-
import type ServerLoadEvent from "./types/ServerLoadEvent";
|
|
12
|
-
import type ServerRequest from "./types/ServerRequest";
|
|
13
|
-
|
|
14
|
-
// NOTE: Don't export any general functionality from here -- it may result in
|
|
15
|
-
// Vite errors like `Could not resolve '../pkg' in lightningcss` etc
|
|
16
|
-
|
|
17
|
-
export { Site, Router };
|
|
18
|
-
|
|
19
|
-
export type {
|
|
20
|
-
Adapter,
|
|
21
|
-
PageEndPoint,
|
|
22
|
-
PageServerEndPoint,
|
|
23
|
-
PageServerLoad,
|
|
24
|
-
PageServerAction,
|
|
25
|
-
ServerEndPoint,
|
|
26
|
-
ServerRequest,
|
|
27
|
-
ServerHook,
|
|
28
|
-
PageLoadEvent,
|
|
29
|
-
ServerLoadEvent,
|
|
30
|
-
};
|