Skip to content

Commit

Permalink
shoveling
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda committed Feb 28, 2024
1 parent 143d584 commit b2f71c2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Node CI

# Push tests commits; pull_request tests PR merges
on: [ push, pull_request ]
on: [ ]

defaults:
run:
Expand Down
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,34 @@
".arc"
],
"dependencies": {
"@architect/asap": "^7.0.4",
"@architect/functions": "^8.0.1",
"@begin/data": "^5.0.1",
"@architect/asap": "^7.0.7",
"@architect/functions": "^8.0.4",
"@begin/data": "^5.0.3",
"@enhance/arc-plugin-rollup": "^2.0.0",
"@enhance/arc-plugin-styles": "^5.0.5",
"@enhance/core": "^0.0.3-RC.1",
"@enhance/core": "alpha",
"@enhance/enhance-style-transform": "^0.1.2",
"@enhance/import-transform": "^4.0.1",
"@enhance/loader": "^0.0.1-RC.2",
"@enhance/ssr": "^3.5.1",
"@enhance/loader": "alpha",
"@enhance/ssr": "^3.5.2",
"glob": "^9.3.5",
"header-timers": "^0.2.0",
"header-timers": "^0.2.1",
"path-to-regexp": "^6.2.1"
},
"devDependencies": {
"@architect/eslint-config": "^2.1.2",
"@architect/sandbox": "^6.0.1",
"eslint": "^8.56.0",
"@architect/sandbox": "^6.0.2",
"eslint": "^8.57.0",
"tap-arc": "^1.2.2",
"tape": "^5.7.4",
"tape": "^5.7.5",
"tiny-json-http": "^7.5.1"
},
"eslintConfig": {
"extends": "@architect/eslint-config",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2022
},
"overrides": [
{
"files": [
Expand Down
31 changes: 26 additions & 5 deletions src/http/any-catchall/index.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import path from 'node:path'
import url from 'node:url'

import arc from '@architect/functions'
import router from './router.mjs'
import loader from '@enhance/loader'
import core from '@enhance/core'
import importTransform from '@enhance/import-transform'
import styleTransform from '@enhance/enhance-style-transform'

import { getState, head, preflight, postflight } from './helpers.mjs'

const DEBUG = 1

const here = path.dirname(url.fileURLToPath(import.meta.url)) // SOMEDAY: import.meta.dirname
const basePath = path.join(here, 'node_modules', '@architect', 'views')
Expand All @@ -15,10 +23,23 @@ const basePath = path.join(here, 'node_modules', '@architect', 'views')
// "Core" routeAndRender
// post-route: fingerprint paths + merge headers

export function createRouter (base) {
base = base || basePath
let config = await loader({ basePath })

export async function createRouter (base) {
if (base) config = await loader({ basePath: base })

const app = core({
...config,
ssrOptions: {
scriptTransforms: [ importTransform({ lookup: arc.static }) ],
styleTransforms: [ styleTransform ],
},
state: getState(),
head,
debug: DEBUG > 0,
})

// return arc.http(router.bind({}, { basePath: base }))
return app
}

export const handler = routeAndRender()
export const handler = (await createRouter()).routeAndRender

0 comments on commit b2f71c2

Please sign in to comment.