diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 1550f6c7..b9ad70cf 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -30,15 +30,12 @@ "@angular/platform-server": "18", "@angular/ssr": "18", "@babel/core": "7", - "@marko/compiler": "5", - "@marko/translator-default": "6", "babel-preset-solid": "1", "eta": "3", "handlebars": "4", "htmx-esm": "0.2", "linkedom-global": "1", "marked": "13", - "marko": "5", "primate": "workspace:^", "react": "18", "react-dom": "18", @@ -67,12 +64,6 @@ "@babel/core": { "optional": true }, - "@marko/compiler": { - "optional": true - }, - "@marko/translator-default": { - "optional": true - }, "babel-preset-solid": { "optional": true }, @@ -91,9 +82,6 @@ "marked": { "optional": true }, - "marko": { - "optional": true - }, "react": { "optional": true }, @@ -178,6 +166,10 @@ "./*/context/app": "./src/server/*/context/app.js", "./*/context/head": "./src/server/*/context/head.js", "./webc/Component": "./src/server/webc/public/Component.js", + "./core/*": { + "@primate/lt": "./src/private/*.js", + "default": "./src/private/*.js" + }, "./*": { "runtime": "./src/server/*/public/runtime.js", "default": "./src/server/*/public/default.js" diff --git a/packages/frontend/src/server/marko/dependencies.js b/packages/frontend/src/server/marko/dependencies.js deleted file mode 100644 index 0c9ae42d..00000000 --- a/packages/frontend/src/server/marko/dependencies.js +++ /dev/null @@ -1 +0,0 @@ -export default ["marko", "@marko/compiler", "@marko/translator-default"]; diff --git a/packages/frontend/src/server/marko/name.js b/packages/frontend/src/server/marko/name.js deleted file mode 100644 index 39fbfcba..00000000 --- a/packages/frontend/src/server/marko/name.js +++ /dev/null @@ -1 +0,0 @@ -export default "marko"; diff --git a/packages/frontend/src/server/marko/public/default.js b/packages/frontend/src/server/marko/public/default.js deleted file mode 100644 index aa68aa2e..00000000 --- a/packages/frontend/src/server/marko/public/default.js +++ /dev/null @@ -1,10 +0,0 @@ -import build from "#marko/build"; -import default_extension from "#marko/extension"; -import name from "#marko/name"; -import serve from "#marko/serve"; - -export default ({ extension = default_extension } = {}) => ({ - name: `primate:${name}`, - build: build(extension), - serve: serve(extension), -}); diff --git a/packages/frontend/src/server/marko/public/runtime.js b/packages/frontend/src/server/marko/public/runtime.js deleted file mode 100644 index e5109a0f..00000000 --- a/packages/frontend/src/server/marko/public/runtime.js +++ /dev/null @@ -1,8 +0,0 @@ -import default_extension from "#marko/extension"; -import name from "#marko/name"; -import serve from "#marko/serve"; - -export default ({ extension = default_extension } = {}) => ({ - name: `primate:${name}`, - serve: serve(extension), -}); diff --git a/packages/marko/package.json b/packages/marko/package.json new file mode 100644 index 00000000..468b20f0 --- /dev/null +++ b/packages/marko/package.json @@ -0,0 +1,46 @@ +{ + "name": "@primate/marko", + "version": "0.1.0", + "description": "Primate Marko 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/marko" + }, + "dependencies": { + "@primate/core": "workspace:^" + }, + "peerDependencies": { + "@marko/compiler": "5", + "@marko/translator-default": "6", + "marko": "5", + "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" + } + } +} diff --git a/packages/frontend/src/server/marko/build/index.js b/packages/marko/src/private/build/index.js similarity index 78% rename from packages/frontend/src/server/marko/build/index.js rename to packages/marko/src/private/build/index.js index 6f3ba8c1..fca08deb 100644 --- a/packages/frontend/src/server/marko/build/index.js +++ b/packages/marko/src/private/build/index.js @@ -1,5 +1,5 @@ -import compile from "#compile"; -import name from "#marko/name"; +import name from "#name"; +import compile from "@primate/frontend/core/compile"; import server from "./server.js"; export default extension => async (app, next) => { diff --git a/packages/frontend/src/server/marko/build/server.js b/packages/marko/src/private/build/server.js similarity index 100% rename from packages/frontend/src/server/marko/build/server.js rename to packages/marko/src/private/build/server.js diff --git a/packages/frontend/src/server/marko/extension.js b/packages/marko/src/private/extension.js similarity index 100% rename from packages/frontend/src/server/marko/extension.js rename to packages/marko/src/private/extension.js diff --git a/packages/marko/src/private/name.js b/packages/marko/src/private/name.js new file mode 100644 index 00000000..6b63de59 --- /dev/null +++ b/packages/marko/src/private/name.js @@ -0,0 +1 @@ +export default "@primate/marko"; diff --git a/packages/frontend/src/server/marko/serve/index.js b/packages/marko/src/private/serve/index.js similarity index 57% rename from packages/frontend/src/server/marko/serve/index.js rename to packages/marko/src/private/serve/index.js index 0d399481..1025839d 100644 --- a/packages/frontend/src/server/marko/serve/index.js +++ b/packages/marko/src/private/serve/index.js @@ -1,4 +1,4 @@ -import serve from "#serve"; +import serve from "@primate/frontend/core/serve"; import render from "./render.js"; export default serve({ render }); diff --git a/packages/frontend/src/server/marko/serve/render.js b/packages/marko/src/private/serve/render.js similarity index 100% rename from packages/frontend/src/server/marko/serve/render.js rename to packages/marko/src/private/serve/render.js diff --git a/packages/marko/src/public/default.js b/packages/marko/src/public/default.js new file mode 100644 index 00000000..c7af2698 --- /dev/null +++ b/packages/marko/src/public/default.js @@ -0,0 +1,10 @@ +import build from "#build"; +import default_extension from "#extension"; +import name from "#name"; +import serve from "#serve"; + +export default ({ extension = default_extension } = {}) => ({ + name, + build: build(extension), + serve: serve(extension), +}); diff --git a/packages/marko/src/public/runtime.js b/packages/marko/src/public/runtime.js new file mode 100644 index 00000000..f8fdaa86 --- /dev/null +++ b/packages/marko/src/public/runtime.js @@ -0,0 +1,8 @@ +import default_extension from "#extension"; +import name from "#name"; +import serve from "#serve"; + +export default ({ extension = default_extension } = {}) => ({ + name, + serve: serve(extension), +}); diff --git a/packages/marko/tsconfig.json b/packages/marko/tsconfig.json new file mode 100644 index 00000000..9536a0f4 --- /dev/null +++ b/packages/marko/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.base.json" +}