Skip to content

Commit

Permalink
recreate @primate/react
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Aug 4, 2024
1 parent f09b023 commit 38d88f2
Show file tree
Hide file tree
Showing 25 changed files with 89 additions and 29 deletions.
8 changes: 0 additions & 8 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
"@babel/core": "7",
"babel-preset-solid": "1",
"primate": "workspace:^",
"react": "18",
"react-dom": "18",
"solid-js": "1",
"svelte": "4"
},
Expand All @@ -39,12 +37,6 @@
"babel-preset-solid": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
},
"solid-js": {
"optional": true
},
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/server/react/dependencies.js

This file was deleted.

63 changes: 63 additions & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "@primate/react",
"version": "0.12.0",
"description": "Primate React frontend",
"homepage": "https://primatejs.com/modules/react",
"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/react"
},
"dependencies": {
"@primate/frontend": "workspace:^",
"@rcompat/build": "^0.4.0",
"@rcompat/fs": "^0.4.0",
"@rcompat/platform": "^0.3.0"
},
"peerDependencies": {
"primate": "workspace:^",
"react": "18",
"react-dom": "18"
},
"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"
},
"#context/*": {
"@primate/lt": "./src/private/context/*.js",
"default": "./src/private/context/*.js"
},
"#client": {
"@primate/lt": "./src/private/client/index.js",
"default": "./src/private/client/index.js"
},
"#client/*": {
"@primate/lt": "./src/private/client/*.js",
"default": "./src/private/client/*.js"
}
},
"exports": {
".": {
"runtime": "./src/public/runtime.js",
"default": "./src/public/default.js"
},
"./head": "./src/public/head.js",
"./context/*": "./src/public/context/*.js"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import build from "#build";
import create_root from "#react/client/create-root";
import expose from "#react/client/expose";
import name from "#react/name";
import create_root from "#client/create-root";
import expose from "#client/expose";
import name from "#name";
import build from "@primate/frontend/core/build";
import client from "./client.js";
import publish from "./publish.js";
import server from "./server.js";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default length => {

return `
import { createElement, useState } from "react";
import AppContext from "@primate/frontend/react/context/app";
import HeadContext from "@primate/frontend/react/context/head";
import AppContext from "@primate/react/context/app";
import HeadContext from "@primate/react/context/head";
import platform from "@rcompat/platform";
export default ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export default `
const { createElement } = React;
export { createElement };
export { hydrateRoot } from "react-dom/client";
export { default as ReactHead } from "@primate/frontend/react/head";
export { default as ReactHead } from "@primate/react/head";
`;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/react/src/private/pkgname.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "@primate/react";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import handler from "#handler";
import client from "#react/client";
import name from "#react/name";
import client from "#client";
import name from "#name";
import handler from "@primate/frontend/core/handler";
import render from "./render.js";

export default (extension, spa) => (app, next) => {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/react/src/public/context/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "#context/app";
1 change: 1 addition & 0 deletions packages/react/src/public/context/head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "#context/head";
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import build from "#react/build";
import default_extension from "#react/extension";
import name from "#react/name";
import serve from "#react/serve";
import build from "#build";
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({
extension = default_extension,
// activate fetch-based browsing
spa = true,
} = {}) => ({
name: `primate:${name}`,
name: pkgname,
build: build(extension),
serve: serve(extension, spa),
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HeadContext from "@primate/frontend/react/context/head";
import HeadContext from "@primate/react/context/head";
import platform from "@rcompat/platform";
import { Component } from "react";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import default_extension from "#react/extension";
import name from "#react/name";
import serve from "#react/serve";
import default_extension from "#extension";
import pkgname from "#pkgname";
import serve from "#serve";

export default ({
extension = default_extension,
// activate fetch-based browsing
spa = true,
} = {}) => ({
name: `primate:${name}`,
name: pkgname,
serve: serve(extension, spa),
});
3 changes: 3 additions & 0 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json"
}

0 comments on commit 38d88f2

Please sign in to comment.