Skip to content

Commit daad4ba

Browse files
authored
Merge pull request #37 from NullVoxPopuli/dont-use-node
Don't use node APIs (require)
2 parents 61207bc + 77ba477 commit daad4ba

File tree

4 files changed

+525
-8
lines changed

4 files changed

+525
-8
lines changed

Diff for: index.html

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<html>
2+
<!-- View this file with `pnpm dev:browser` -->
3+
4+
<head>
5+
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
6+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
7+
<script type="module">
8+
import decoratorTransforms from 'decorator-transforms';
9+
10+
const output = Babel.transform(
11+
`
12+
import { tracked } from '@glimmer/tracking';
13+
14+
export class Demo {
15+
@tracked count = 0;
16+
17+
increment = () => this.count++;
18+
}
19+
`,
20+
{
21+
plugins: [
22+
// This plugin
23+
[
24+
decoratorTransforms,
25+
{
26+
runtime: {
27+
import: 'decorator-transforms/globals',
28+
},
29+
},
30+
],
31+
],
32+
},
33+
);
34+
35+
document.querySelector('#output').innerHTML = output.code;
36+
</script>
37+
</head>
38+
39+
<body>
40+
<pre id="output"></pre>
41+
</body>
42+
</html>

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
],
3232
"scripts": {
3333
"build": "tsup --dts",
34+
"dev:browser": "vite",
3435
"lint": "tsc && prettier --check .",
3536
"lint:fix": "prettier --write .",
3637
"start": "tsup --dts --watch",
@@ -57,7 +58,8 @@
5758
"qunit": "^2.20.0",
5859
"release-plan": "^0.9.0",
5960
"tsup": "^7.3.0",
60-
"typescript": "^5.4.5"
61+
"typescript": "^5.4.5",
62+
"vite": "^5.4.10"
6163
},
6264
"typesVersions": {
6365
"*": {

0 commit comments

Comments
 (0)