Skip to content

Commit

Permalink
create @primate/webc
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Aug 4, 2024
1 parent 3f8f6aa commit f09b023
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 31 deletions.
3 changes: 1 addition & 2 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@primate/core": "workspace:^",
"@rcompat/async": "^0.3.0",
"@rcompat/build": "^0.3.0",
"@rcompat/build": "^0.4.0",
"@rcompat/crypto": "^0.5.0",
"@rcompat/fs": "^0.4.0",
"@rcompat/http": "^0.5.0",
Expand Down Expand Up @@ -113,7 +113,6 @@
"./*/head": "./src/server/*/public/head.js",
"./*/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"
Expand Down
8 changes: 0 additions & 8 deletions packages/frontend/src/private/error/no-class-name.js

This file was deleted.

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

This file was deleted.

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

This file was deleted.

50 changes: 50 additions & 0 deletions packages/webc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@primate/webc",
"version": "0.1.0",
"description": "Primate Web Components frontend",
"homepage": "https://primatejs.com/modules/webc",
"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/webc"
},
"dependencies": {
"@primate/frontend": "workspace:^",
"@rcompat/fs": "^0.4.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"
},
"#client": {
"@primate/lt": "./src/private/client/index.js",
"default": "./src/private/client/index.js"
}
},
"exports": {
".": {
"runtime": "./src/public/runtime.js",
"default": "./src/public/default.js"
},
"./Component": "./src/public/Component.js"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import compile from "#compile";
import name from "#webc/name";
import name from "#name";
import compile from "@primate/frontend/core/compile";
import client from "./client.js";
import publish from "./publish.js";

Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions packages/webc/src/private/error/no-class-name.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 component at {0} is missing a class name",
fix: "add a class name to the component",
});
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/webc/src/private/pkgname.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "@primate/webc";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import client from "#webc/client";
import client from "#client";

export default (name, props = {}, options = {}) => async app => {
const [component] = name.split(".");
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions packages/webc/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),
});
8 changes: 8 additions & 0 deletions packages/webc/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/webc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json"
}

0 comments on commit f09b023

Please sign in to comment.