-
-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add postinstall for git-hooks
- Loading branch information
花果山大圣
committed
Jun 9, 2023
1 parent
4f22b03
commit f0a3529
Showing
41 changed files
with
779 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
const jsxTransform = require("babel-plugin-jsx-dom-expressions"); | ||
|
||
module.exports = function (context, options = {}) { | ||
const plugins = [ | ||
[ | ||
jsxTransform, | ||
Object.assign( | ||
{ | ||
moduleName: "solid-js/web", | ||
builtIns: [ | ||
"For", | ||
"Show", | ||
"Switch", | ||
"Match", | ||
"Suspense", | ||
"SuspenseList", | ||
"Portal", | ||
"Index", | ||
"Dynamic", | ||
"ErrorBoundary" | ||
], | ||
contextToCustomElements: true, | ||
wrapConditionals: true, | ||
generate: "dom" | ||
}, | ||
options | ||
) | ||
] | ||
]; | ||
|
||
return { | ||
plugins | ||
}; | ||
}; | ||
const jsxTransform = require("babel-plugin-jsx-dom-expressions"); | ||
|
||
module.exports = function (context, options = {}) { | ||
const plugins = [ | ||
[ | ||
jsxTransform, | ||
Object.assign( | ||
{ | ||
moduleName: "solid-js/web", | ||
builtIns: [ | ||
"For", | ||
"Show", | ||
"Switch", | ||
"Match", | ||
"Suspense", | ||
"SuspenseList", | ||
"Portal", | ||
"Index", | ||
"Dynamic", | ||
"ErrorBoundary" | ||
], | ||
contextToCustomElements: true, | ||
wrapConditionals: true, | ||
generate: "dom" | ||
}, | ||
options | ||
) | ||
] | ||
]; | ||
|
||
return { | ||
plugins | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
const babel = require("@babel/core"); | ||
const preset = require("."); | ||
const assert = require("assert"); | ||
|
||
const { code } = babel.transformSync("const v = <div a b={2} />;", { | ||
presets: [preset], | ||
babelrc: false, | ||
compact: true | ||
}); | ||
|
||
assert.equal( | ||
code, | ||
'import{template as _$template}from"solid-js/web";const _tmpl$=/*#__PURE__*/_$template(`<div a b="2">`);const v=_tmpl$();' | ||
); | ||
console.log("passed"); | ||
const babel = require("@babel/core"); | ||
const preset = require("."); | ||
const assert = require("assert"); | ||
|
||
const { code } = babel.transformSync("const v = <div a b={2} />;", { | ||
presets: [preset], | ||
babelrc: false, | ||
compact: true | ||
}); | ||
|
||
assert.equal( | ||
code, | ||
'import{template as _$template}from"solid-js/web";const _tmpl$=/*#__PURE__*/_$template(`<div a b="2">`);const v=_tmpl$();' | ||
); | ||
console.log("passed"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import express from "express"; | ||
import url from "url"; | ||
|
||
import { renderToStringAsync } from "solid-js/web"; | ||
import App from "../shared/src/components/App"; | ||
|
||
const app = express(); | ||
const port = 8080; | ||
|
||
app.use(express.static(url.fileURLToPath(new URL("../public", import.meta.url)))); | ||
|
||
app.get("*", async (req, res) => { | ||
let result; | ||
try { | ||
result = await renderToStringAsync(() => <App url={req.url} />); | ||
} catch (err) { | ||
console.error(err); | ||
} finally { | ||
res.send(result); | ||
} | ||
}); | ||
|
||
app.listen(port, () => console.log(`Example app listening on port ${port}!`)); | ||
import express from "express"; | ||
import url from "url"; | ||
|
||
import { renderToStringAsync } from "solid-js/web"; | ||
import App from "../shared/src/components/App"; | ||
|
||
const app = express(); | ||
const port = 8080; | ||
|
||
app.use(express.static(url.fileURLToPath(new URL("../public", import.meta.url)))); | ||
|
||
app.get("*", async (req, res) => { | ||
let result; | ||
try { | ||
result = await renderToStringAsync(() => <App url={req.url} />); | ||
} catch (err) { | ||
console.error(err); | ||
} finally { | ||
res.send(result); | ||
} | ||
}); | ||
|
||
app.listen(port, () => console.log(`Example app listening on port ${port}!`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
import nodeResolve from "@rollup/plugin-node-resolve"; | ||
import common from "@rollup/plugin-commonjs"; | ||
import babel from "@rollup/plugin-babel"; | ||
import copy from "rollup-plugin-copy"; | ||
|
||
export default [ | ||
{ | ||
input: "examples/async/index.js", | ||
output: [ | ||
{ | ||
dir: "examples/async/lib", | ||
format: "esm" | ||
} | ||
], | ||
preserveEntrySignatures: false, | ||
external: ["solid-js", "solid-js/web", "path", "express"], | ||
plugins: [ | ||
nodeResolve({ preferBuiltins: true, exportConditions: ["solid", "node"] }), | ||
babel({ | ||
babelHelpers: "bundled", | ||
presets: [["solid", { generate: "ssr", hydratable: true }]] | ||
}), | ||
common() | ||
] | ||
}, | ||
{ | ||
input: "examples/shared/src/index.js", | ||
output: [ | ||
{ | ||
dir: "examples/async/public/js", | ||
format: "esm" | ||
} | ||
], | ||
preserveEntrySignatures: false, | ||
plugins: [ | ||
nodeResolve({ exportConditions: ["solid"] }), | ||
babel({ | ||
babelHelpers: "bundled", | ||
presets: [["solid", { generate: "dom", hydratable: true }]] | ||
}), | ||
common(), | ||
copy({ | ||
targets: [ | ||
{ | ||
src: ["examples/shared/static/*"], | ||
dest: "examples/async/public" | ||
} | ||
] | ||
}) | ||
] | ||
} | ||
]; | ||
import nodeResolve from "@rollup/plugin-node-resolve"; | ||
import common from "@rollup/plugin-commonjs"; | ||
import babel from "@rollup/plugin-babel"; | ||
import copy from "rollup-plugin-copy"; | ||
|
||
export default [ | ||
{ | ||
input: "examples/async/index.js", | ||
output: [ | ||
{ | ||
dir: "examples/async/lib", | ||
format: "esm" | ||
} | ||
], | ||
preserveEntrySignatures: false, | ||
external: ["solid-js", "solid-js/web", "path", "express"], | ||
plugins: [ | ||
nodeResolve({ preferBuiltins: true, exportConditions: ["solid", "node"] }), | ||
babel({ | ||
babelHelpers: "bundled", | ||
presets: [["solid", { generate: "ssr", hydratable: true }]] | ||
}), | ||
common() | ||
] | ||
}, | ||
{ | ||
input: "examples/shared/src/index.js", | ||
output: [ | ||
{ | ||
dir: "examples/async/public/js", | ||
format: "esm" | ||
} | ||
], | ||
preserveEntrySignatures: false, | ||
plugins: [ | ||
nodeResolve({ exportConditions: ["solid"] }), | ||
babel({ | ||
babelHelpers: "bundled", | ||
presets: [["solid", { generate: "dom", hydratable: true }]] | ||
}), | ||
common(), | ||
copy({ | ||
targets: [ | ||
{ | ||
src: ["examples/shared/static/*"], | ||
dest: "examples/async/public" | ||
} | ||
] | ||
}) | ||
] | ||
} | ||
]; |
Oops, something went wrong.