Skip to content

Commit

Permalink
add @primate/html, readd @primate/htmx
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Aug 4, 2024
1 parent d8fa21d commit 2c5ca89
Show file tree
Hide file tree
Showing 37 changed files with 166 additions and 60 deletions.
8 changes: 5 additions & 3 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
"@angular/platform-browser": "18",
"@angular/platform-server": "18",
"@angular/ssr": "18",
"@primate/core": "workspace:^",
"@primate/frontend": "workspace:^",
"@rcompat/build": "^0.3.0",
"@rcompat/object": "^0.5.0",
"zone.js": "0.14"
},
"peerDependencies": {
"vue": "3",
"primate": "workspace:^"
"primate": "workspace:^",
"vue": "3"
},
"type": "module",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"directory": "packages/eta"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^"
},
"peerDependencies": {
"eta": "3",
Expand Down
4 changes: 0 additions & 4 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"peerDependencies": {
"@babel/core": "7",
"babel-preset-solid": "1",
"htmx-esm": "0.2",
"primate": "workspace:^",
"react": "18",
"react-dom": "18",
Expand All @@ -40,9 +39,6 @@
"babel-preset-solid": {
"optional": true
},
"htmx-esm": {
"optional": true
},
"react": {
"optional": true
},
Expand Down
8 changes: 0 additions & 8 deletions packages/frontend/src/private/error/no-client-extension.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/frontend/src/server/html/public/default.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/frontend/src/server/html/public/runtime.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/frontend/src/server/htmx/dependencies.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/frontend/src/server/htmx/public/runtime.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/handlebars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"directory": "packages/handlebars"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^"
},
"peerDependencies": {
"handlebars": "4",
Expand Down
45 changes: 45 additions & 0 deletions packages/html/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@primate/html",
"version": "0.1.0",
"description": "Primate HTML frontend",
"bugs": "https://github.com/primatejs/primate/issues",
"license": "MIT",
"files": [
"src/**/*.js",
"!src/**/*.spec.js"
],
"repository": {
"type": "git",
"url": "https://github.com/primatejs/primate",
"directory": "packages/html"
},
"dependencies": {
"@primate/frontend": "workspace:^",
"@rcompat/string": "^0.3.0"
},
"peerDependencies": {
"primate": "workspace:^"
},
"type": "module",
"imports": {
"#*": {
"@primate/lt": "./src/private/*.js",
"default": "./src/private/*.js"
},
"#build": {
"@primate/lt": "./src/private/build/index.js",
"default": "./src/private/build/index.js"
},
"#serve": {
"@primate/lt": "./src/private/serve/index.js",
"default": "./src/private/serve/index.js"
}
},
"exports": {
".": {
"runtime": "./src/public/runtime.js",
"default": "./src/public/default.js"
},
"./handler": "./src/public/handler.js"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import compile from "#compile";
import name from "#html/name";
import name from "#name";
import compile from "@primate/frontend/core/compile";
import server from "./server.js";

export default extension => async (app, next) => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import render from "#render";
import render from "@primate/frontend/core/render";

const script_re = /(?<=<script)>(?<code>.*?)(?=<\/script>)/gus;
const style_re = /(?<=<style)>(?<code>.*?)(?=<\/style>)/gus;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/html/src/private/pkgname.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "@primate/html";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import handler from "#html/handler";
import handler from "#handler";

export default extension => (app, next) => {
app.register(extension, handler);
Expand Down
10 changes: 10 additions & 0 deletions packages/html/src/public/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import build from "#build";
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({ extension = default_extension } = {}) => ({
name: pkgname,
build: build(extension),
serve: serve(extension),
});
1 change: 1 addition & 0 deletions packages/html/src/public/handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "#handler";
8 changes: 8 additions & 0 deletions packages/html/src/public/runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({ extension = default_extension } = {}) => ({
name: pkgname,
serve: serve(extension),
});
3 changes: 3 additions & 0 deletions packages/html/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json"
}
51 changes: 51 additions & 0 deletions packages/htmx/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@primate/htmx",
"version": "0.1.0",
"description": "Primate HTMX frontend",
"bugs": "https://github.com/primatejs/primate/issues",
"license": "MIT",
"files": [
"src/**/*.js",
"!src/**/*.spec.js"
],
"repository": {
"type": "git",
"url": "https://github.com/primatejs/primate",
"directory": "packages/htmx"
},
"dependencies": {
"@primate/frontend": "workspace:^",
"@primate/html": "workspace:^",
"@rcompat/object": "^0.5.0",
"@rcompat/string": "^0.3.0"
},
"peerDependencies": {
"htmx-esm": "0.2",
"primate": "workspace:^"
},
"type": "module",
"imports": {
"#*": {
"@primate/lt": "./src/private/*.js",
"default": "./src/private/*.js"
},
"#build": {
"@primate/lt": "./src/private/build/index.js",
"default": "./src/private/build/index.js"
},
"#serve": {
"@primate/lt": "./src/private/serve/index.js",
"default": "./src/private/serve/index.js"
},
"#error/*": {
"@primate/lt": "./src/private/error/*.js",
"default": "./src/private/error/*.js"
}
},
"exports": {
".": {
"runtime": "./src/public/runtime.js",
"default": "./src/public/default.js"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import compile from "#compile";
import no_client_extension from "#error/no-client-extension";
import name from "#htmx/name";
import name from "#name";
import compile from "@primate/frontend/core/compile";
import empty from "@rcompat/object/empty";
import server from "./server.js";

Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions packages/htmx/src/private/error/no-client-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pkgname from "#pkgname";
import log from "@primate/core/log";
import file from "@rcompat/fs/file";

export default (...params) => log.error({
params,
name: file(import.meta.url).base,
module: pkgname,
message: "the extension {0} is required for {1} client side support",
fix: "add \"{0}\" to the `extensions` array for the HTMX module",
});
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/htmx/src/private/pkgname.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "@primate/htmx";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import handler from "#html/handler";
import handler from "@primate/html/handler";

export default (name, props, options = {}) => async (app, _, request) => {
const code = "import { htmx } from \"app\";";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import build from "#htmx/build";
import default_extension from "#htmx/extension";
import name from "#htmx/name";
import serve from "#htmx/serve";
import build from "#build";
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({
extension = default_extension,
extensions = [],
client_side_templates = [],
} = {}) => ({
name: `primate:${name}`,
name: pkgname,
build: build({ extension, extensions, client_side_templates }),
serve: serve(extension),
});
8 changes: 8 additions & 0 deletions packages/htmx/src/public/runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({ extension = default_extension } = {}) => ({
name: pkgname,
serve: serve(extension),
});
3 changes: 3 additions & 0 deletions packages/htmx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json"
}
2 changes: 1 addition & 1 deletion packages/markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"directory": "packages/markdown"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^"
},
"peerDependencies": {
"marked": "13",
Expand Down
2 changes: 1 addition & 1 deletion packages/marko/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"directory": "packages/marko"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^"
},
"peerDependencies": {
"@marko/compiler": "5",
Expand Down
3 changes: 2 additions & 1 deletion packages/voby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"directory": "packages/voby"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^",
"@rcompat/build": "^0.3.0"
},
"peerDependencies": {
"linkedom-global": "1",
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"directory": "packages/vue"
},
"dependencies": {
"@primate/core": "workspace:^"
"@primate/frontend": "workspace:^"
},
"peerDependencies": {
"vue": "3",
Expand Down

0 comments on commit 2c5ca89

Please sign in to comment.