mancha 0.24.0 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +26 -7
  2. package/dist/browser.d.ts +451 -2
  3. package/dist/browser.js +32 -1
  4. package/dist/cli.js +3 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/css_gen_utils.d.ts +8 -915
  7. package/dist/css_gen_utils.js +382 -641
  8. package/dist/css_gen_utils.js.map +1 -1
  9. package/dist/mancha.js +25 -36
  10. package/dist/plugins.js +11 -1
  11. package/dist/plugins.js.map +1 -1
  12. package/dist/store.d.ts +8 -1
  13. package/dist/store.js +10 -3
  14. package/dist/store.js.map +1 -1
  15. package/dist/trusted_attributes.d.ts +0 -3
  16. package/dist/trusted_attributes.js +1 -3
  17. package/dist/trusted_attributes.js.map +1 -1
  18. package/docs/01_syntax.md +2 -0
  19. package/docs/03_reactivity.md +20 -3
  20. package/docs/05_css.md +270 -275
  21. package/docs/06_ssr.md +3 -2
  22. package/docs/07_typescript.md +5 -5
  23. package/docs/10_security.md +204 -0
  24. package/package.json +20 -7
  25. package/.biomeignore +0 -3
  26. package/.github/workflows/ci.yml +0 -109
  27. package/.vscode/extensions.json +0 -3
  28. package/.vscode/launch.json +0 -34
  29. package/biome.json +0 -46
  30. package/dist/browser.js.map +0 -1
  31. package/dist/expressions/ast.test.d.ts +0 -1
  32. package/dist/expressions/ast.test.js +0 -147
  33. package/dist/expressions/ast.test.js.map +0 -1
  34. package/dist/expressions/ast_factory.test.d.ts +0 -1
  35. package/dist/expressions/ast_factory.test.js +0 -94
  36. package/dist/expressions/ast_factory.test.js.map +0 -1
  37. package/dist/expressions/constants.test.d.ts +0 -1
  38. package/dist/expressions/constants.test.js +0 -84
  39. package/dist/expressions/constants.test.js.map +0 -1
  40. package/dist/expressions/eval.test.d.ts +0 -1
  41. package/dist/expressions/eval.test.js +0 -215
  42. package/dist/expressions/eval.test.js.map +0 -1
  43. package/dist/expressions/expressions.test.d.ts +0 -6
  44. package/dist/expressions/expressions.test.js +0 -7
  45. package/dist/expressions/expressions.test.js.map +0 -1
  46. package/dist/expressions/parser.test.d.ts +0 -1
  47. package/dist/expressions/parser.test.js +0 -174
  48. package/dist/expressions/parser.test.js.map +0 -1
  49. package/dist/expressions/tokenizer.test.d.ts +0 -1
  50. package/dist/expressions/tokenizer.test.js +0 -124
  51. package/dist/expressions/tokenizer.test.js.map +0 -1
  52. package/dist/interfaces-C8heJ6BZ.d.ts +0 -452
  53. package/dist/mancha.js.map +0 -1
  54. package/dist/renderer-B4AORGUN.js +0 -43
  55. package/dist/safe_browser.d.ts +0 -16
  56. package/dist/safe_browser.js +0 -1
  57. package/dist/safe_browser.js.map +0 -1
  58. package/dist/test_types/api.d.ts +0 -11
  59. package/dist/test_types/api.js +0 -3
  60. package/dist/test_types/api.js.map +0 -1
  61. package/dist/test_types/nested/child.d.ts +0 -12
  62. package/dist/test_types/nested/child.js +0 -2
  63. package/dist/test_types/nested/child.js.map +0 -1
  64. package/dist/test_types/product.d.ts +0 -11
  65. package/dist/test_types/product.js +0 -3
  66. package/dist/test_types/product.js.map +0 -1
  67. package/dist/test_types/user.d.ts +0 -10
  68. package/dist/test_types/user.js +0 -3
  69. package/dist/test_types/user.js.map +0 -1
  70. package/dist/test_utils.d.ts +0 -20
  71. package/dist/test_utils.js +0 -94
  72. package/dist/test_utils.js.map +0 -1
  73. package/global.d.ts +0 -4
  74. package/gulpfile.ts +0 -47
  75. package/scripts/generate-css-docs.ts +0 -622
  76. package/tsconfig.json +0 -37
  77. package/tsdown.config.ts +0 -32
  78. package/tsec_exemptions.json +0 -9
package/docs/06_ssr.md CHANGED
@@ -18,7 +18,8 @@ src/
18
18
  You can run the following command to compile the site into a `public` folder:
19
19
 
20
20
  ```bash
21
- npx mancha --input="./src/index.html" --vars="$(cat vars.json)" --output="./public"
21
+ mkdir -p ./public
22
+ npx mancha render ./src/index.html --vars="$(cat ./src/vars.json)" --output="./public/index.html"
22
23
  ```
23
24
 
24
25
  For a more complete example, see [examples/compiled](../examples/compiled).
@@ -57,7 +58,7 @@ For a more complete example, see [examples/express](../examples/express).
57
58
  For servers hosted as worker runtimes, such as `Cloudflare Workers`, you will need to import a stripped down version of `mancha` that does not have the ability to read local files.
58
59
 
59
60
  ```js
60
- import { Renderer } from "mancha/dist/worker";
61
+ import { Renderer } from "mancha/dist/worker.js";
61
62
  import htmlIndex from "./index.html";
62
63
  import vars from "./vars.json";
63
64
 
@@ -62,16 +62,16 @@ npx mancha check src/index.html
62
62
  npx mancha check src/index.html --strict
63
63
  ```
64
64
 
65
- ### Stripping Types in Production
65
+ ### Types Never Reach the Output
66
66
 
67
- The `:types` attributes are only used for static analysis and have no runtime behavior. However, you may want to remove them from your production HTML to reduce file size and avoid exposing type information:
67
+ The `:types` attributes are only used for static analysis and have no runtime behavior, so rendering always removes them. There is no flag to opt in or out:
68
68
 
69
69
  ```bash
70
- # Render with types stripped
71
- npx mancha render src/index.html --output public/index.html --strip-types
70
+ # :types and data-types are stripped from the rendered output
71
+ npx mancha render src/index.html --output public/index.html
72
72
  ```
73
73
 
74
- The `--strip-types` flag removes all `:types` and `data-types` attributes from the rendered output.
74
+ This holds for every render, in the browser as well as on the server: `:types` and `data-types` are dropped from each node as it is rendered.
75
75
 
76
76
  ### Type Checking with For-Loops
77
77
 
@@ -0,0 +1,204 @@
1
+ # Security
2
+
3
+ `mancha` templates are code, not data. A directive is an expression that the renderer evaluates, so
4
+ rendering a template is equivalent to running the JavaScript in it. There is no mode that changes
5
+ this: `mancha` does not attempt to contain a hostile template, and it does not ship a sanitizer.
6
+
7
+ The boundary is therefore the source of the template, not the content of the template:
8
+
9
+ - **Safe**: render templates you wrote, or that came from your repository, your build, or an author
10
+ you would give commit access to.
11
+ - **Unsafe**: render a template supplied by a user, pulled from a database of user content, or
12
+ fetched from a host you do not control.
13
+
14
+ Values are different from templates. Data you put in the store (a name, a search query, an API
15
+ response) is data, and the text sinks escape it. The rest of this page describes exactly which sinks
16
+ do that, and what a template can reach when you render one.
17
+
18
+ ## Templates Are Programs
19
+
20
+ Every one of these evaluates its value as an expression against the renderer's scope:
21
+
22
+ | Directive | When it evaluates |
23
+ | -------------------------------------- | -------------------------------------------- |
24
+ | `:data` | At mount, and again on keyed `:for` reuse |
25
+ | `:text`, `:html`, `:class`, `:show`, `:if` | At mount, and whenever a dependency changes |
26
+ | `:for`, `:key`, `:bind` | At mount, and whenever a dependency changes |
27
+ | `:attr:{name}`, `:prop:{name}` | At mount, and whenever a dependency changes |
28
+ | `:on:{event}` | Every time the event fires |
29
+ | `{{ ... }}` in a text node | At mount, and whenever a dependency changes |
30
+
31
+ The `data-` forms (`data-text`, `data-on-click`, ...) are the same directives and behave
32
+ identically.
33
+
34
+ Three of them do more than evaluate an expression:
35
+
36
+ - `<include src="...">` and `<link rel="subresource" href="...">` fetch another document and
37
+ preprocess it with the same renderer. The included file's directives run with the same scope and
38
+ privileges as the page that included it. Nesting is bounded only by `maxdepth` (default 10), which
39
+ raises `Maximum recursion depth reached`.
40
+ - `:render="./module.js"` imports that module and calls its default export. Importing runs the
41
+ module's top-level code.
42
+ - `<template is="...">` registers a custom tag. Registration is **first-wins** and the registry is
43
+ shared by reference with every subrenderer, so a fragment rendered early can claim a tag name that
44
+ the rest of the application has not defined yet, and later definitions of that name are ignored.
45
+
46
+ ### The expression scope includes the globals
47
+
48
+ Expressions are parsed by an expression parser rather than `eval()`, but that is a Content Security
49
+ Policy accommodation, not a sandbox. The scope proxy resolves a name against the local arguments,
50
+ then the store, then `globalThis`, so every global is in scope:
51
+
52
+ ```html
53
+ <!-- Reads the document's cookies. -->
54
+ <div :text="document.cookie"></div>
55
+
56
+ <!-- Reads local storage. -->
57
+ <div :text="localStorage.getItem('token')"></div>
58
+
59
+ <!-- On the server, reads the process environment. -->
60
+ <div :text="process.env.DATABASE_URL"></div>
61
+ ```
62
+
63
+ Because ordinary objects are in scope too, `.constructor.constructor` reaches `Function`, and a
64
+ single-expression language becomes an arbitrary-statement one:
65
+
66
+ ```html
67
+ <!-- Runs at mount. -->
68
+ <div :text="({}).constructor.constructor('/* any code at all */')()"></div>
69
+ ```
70
+
71
+ Anything you can do in a `<script>` tag on the page, a template you render can do. Rendering a
72
+ template is the same grant as adding a script tag to the page.
73
+
74
+ ## Escaping, Sink By Sink
75
+
76
+ Escaping applies to the **values** flowing through a template you control, and it is real. Given a
77
+ value of `<img src=x onerror="...">`:
78
+
79
+ | Sink | Result |
80
+ | --------------------------- | ----------------------------------------------------------------- |
81
+ | `:text` | Escaped. Set as `textContent`; no element is created (see below) |
82
+ | `{{ ... }}` | Escaped. Set as text node content; no element is created |
83
+ | `:html` | Parsed as HTML. The element is created and its `onerror` fires |
84
+ | `:attr:{name}` | Written verbatim, including `javascript:` URLs and `on*` handlers |
85
+ | `:prop:{name}` | Assigned to the property directly, with no URL check |
86
+
87
+ `:html` goes further than parsing: the resulting fragment is rendered as a `mancha` template by a
88
+ subrenderer, so directives inside it execute, and in the browser a `<script>` element in that string
89
+ runs when it is inserted.
90
+
91
+ `:text` escapes markup, but it has one edge worth knowing: the text it writes **during mount** is
92
+ still visited by the text-node plugin afterwards, so a value that itself contains `{{ ... }}` is
93
+ evaluated as an expression. Values written by `:text` after mount are not rescanned, and neither is
94
+ the result of a `{{ ... }}` substitution. Prefer `{{ ... }}` for values whose content you do not
95
+ control. This is a bug rather than intended behavior, tracked as
96
+ [#104](https://github.com/fresho-dev/mancha/issues/104); this paragraph goes away when it is fixed.
97
+
98
+ So a value is safe in `{{ ... }}` and, with that caveat, in `:text`; it is unsafe everywhere else.
99
+ This matters most for the values you do not choose yourself:
100
+
101
+ ```html
102
+ <!-- Safe: URL query parameters, form input and API responses are escaped here,
103
+ and the substituted text is not evaluated. -->
104
+ <p>Results for {{ $$search }}</p>
105
+
106
+ <!-- Unsafe: the same value is markup here, and executes. -->
107
+ <div :html="$$search"></div>
108
+
109
+ <!-- Unsafe: an attacker-controlled `javascript:` URL is written through unchanged. -->
110
+ <a :attr:href="$$next">Continue</a>
111
+ ```
112
+
113
+ The rule of thumb: untrusted values may only reach `{{ ... }}`, and `:text` subject to the note
114
+ above. If you need untrusted markup, see
115
+ [Isolating Untrusted Content](#isolating-untrusted-content).
116
+
117
+ ## Whatever You Mount Is A Template
118
+
119
+ Mounting is what turns markup into a program, and it applies to everything under the mount point.
120
+ The script tag form (`<script src="//unpkg.com/mancha" init>`) mounts `body` by default, so any
121
+ content your server wrote into the page is a template, whether you meant it to be one or not.
122
+
123
+ HTML-escaping does not help here, because `{{ ... }}` is ordinary text and survives escaping intact:
124
+
125
+ ```html
126
+ <!-- A comment stored as: {{ (0).constructor.constructor('...')() }} -->
127
+ <!-- Escaped correctly by the server, and still evaluated at mount. -->
128
+ <p>{{ (0).constructor.constructor('...')() }}</p>
129
+ ```
130
+
131
+ Escaping does stop the attribute forms — an escaped `"` cannot open a `:text` attribute — but the
132
+ text-node form needs no attribute at all. If a page carries content from your users, deliver it as a
133
+ store value rendered by `{{ ... }}`, write it into the DOM yourself after mount, or keep it outside
134
+ the mounted subtree.
135
+
136
+ ## Isolating Untrusted Content
137
+
138
+ If you have to display content you do not control, keep it out of the renderer.
139
+
140
+ **Sandboxed iframe.** `mancha` needs `allow-scripts` to run at all, and the sandbox only helps if
141
+ the frame cannot reach back into your page:
142
+
143
+ ```html
144
+ <!-- The frame runs, but cannot touch this document. -->
145
+ <iframe src="/untrusted" sandbox="allow-scripts"></iframe>
146
+
147
+ <!-- Do not do this: the two tokens together give the frame full access to the parent DOM. -->
148
+ <iframe src="/untrusted" sandbox="allow-scripts allow-same-origin"></iframe>
149
+ ```
150
+
151
+ Never combine `allow-scripts` with `allow-same-origin` for content served from your own origin. If
152
+ the frame genuinely needs a same-origin document of its own, serve it from a different origin
153
+ instead, so the origin — not the sandbox attribute — is what separates it from your page.
154
+
155
+ **Render to inert HTML.** Render trusted templates on the server and send the result to the client
156
+ without loading `mancha` there. The output is plain HTML with no directives left in it, so the
157
+ client never evaluates anything. This works because the template being rendered is yours; it is not
158
+ a way to defuse a hostile template, which would still execute on the server (see below).
159
+
160
+ ## Server-Side Rendering
161
+
162
+ Rendering on the server ([SSR](./06_ssr.md)) moves expression evaluation into your server process,
163
+ where the ambient scope is Node's rather than the browser's:
164
+
165
+ - Expressions can read `process`, and anything else on `globalThis` in that process.
166
+ - `<include>` resolves through `fetchLocal`, which reads from the filesystem. An absolute `src`
167
+ reads that path directly, so `<include src="/etc/passwd">` is a file read, not a template error.
168
+ - `:render` imports the module at that path and executes it.
169
+
170
+ Two consequences:
171
+
172
+ 1. **Never assemble a template from request data.** Pass request data as store values, which is what
173
+ the SSR examples do — `new Renderer({ name, ...vars })` — and keep the HTML itself fixed. A
174
+ template string built by concatenating user input is a remote code execution bug, not an XSS bug.
175
+ 2. **Never let a request choose the path you render or include.** `preprocessLocal(req.query.page)`
176
+ lets the caller read any file the process can read.
177
+
178
+ ## What The Library Does Protect
179
+
180
+ These are real, and worth knowing precisely because their scope is narrow:
181
+
182
+ - **`safevalues` at DOM sinks.** Attributes written by the renderer's own bookkeeping go through
183
+ `safeElement.setPrefixedAttribute` with an allowlist of `:`, `style` and `class` prefixes;
184
+ relative-path rebasing for `<a>` and `<area>` goes through `safeAnchorEl` / `safeAreaEl`, which
185
+ drop `javascript:` URLs; injected stylesheets go through `safeStyleEl`. All of these operate on
186
+ values the renderer derived from the template itself. **They do not sanitize `:attr:` or `:prop:`
187
+ values**, which are set directly, as the table above shows.
188
+ - **`tsec` on the build.** `npm run build` type-checks with `tsec`, which bans unsafe DOM sinks
189
+ (`innerHTML`, `eval`, and friends) in `mancha`'s own source, with a small set of reviewed
190
+ exemptions. It constrains how the library is written; it says nothing about what a template does.
191
+ - **CSP compatibility, with a bonus.** Because expressions are parsed rather than `eval`-ed,
192
+ `mancha` runs under a policy with no `'unsafe-eval'`. That same policy also blocks the
193
+ `Function` escape described above: the expression fails and is logged as a failed evaluation. It
194
+ does **not** stop the rest — property reads and method calls on globals such as `document.cookie`
195
+ or `localStorage.getItem(...)` still work — so CSP narrows the blast radius of a hostile template
196
+ without containing it.
197
+
198
+ ## Summary
199
+
200
+ - Render templates only from sources you trust. A template can do whatever a script tag can do.
201
+ - Untrusted **values** are fine in `{{ ... }}` and `:text`, and only there.
202
+ - Untrusted **markup** belongs in a cross-origin or `allow-scripts`-only iframe, never in `:html`.
203
+ - On the server, a hostile template is code execution on your server, and `<include>` is a file
204
+ read. Pass request data as store values, never as template text or template paths.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mancha",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "description": "Javscript HTML rendering engine",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -20,16 +20,25 @@
20
20
  "default": "./dist/*.js"
21
21
  }
22
22
  },
23
+ "files": [
24
+ "dist",
25
+ "docs",
26
+ "!dist/fixtures",
27
+ "!dist/test_types",
28
+ "!dist/test_utils.*",
29
+ "!dist/**/*.test.*"
30
+ ],
23
31
  "scripts": {
24
32
  "clean": "rm -rf dist/",
25
33
  "build": "gulp build",
26
34
  "pretest": "npm run build",
27
35
  "test:node": "mocha 'dist/**/*.test.js' --ignore 'dist/browser.test.js'",
28
- "test:browser": "web-test-runner 'dist/**/*.test.js' '!dist/cli.test.js' '!dist/ssr.test.js' '!dist/index.test.js' '!dist/worker.test.js' '!dist/type_checker.test.js' --node-resolve --compatibility all --playwright --browsers chromium --no-sandbox",
36
+ "test:browser": "web-test-runner 'dist/**/*.test.js' '!dist/cli.test.js' '!dist/ssr.test.js' '!dist/index.test.js' '!dist/worker.test.js' '!dist/type_checker.test.js' '!dist/package.test.js' '!dist/css_gen_lint.test.js' --node-resolve --compatibility all --playwright --browsers chromium --no-sandbox",
29
37
  "test": "npm run test:node && npm run test:browser",
30
38
  "check:size": "brotli -c dist/mancha.js | wc -c",
31
39
  "cli": "node dist/cli.js",
32
40
  "gen:docs": "tsx scripts/generate-css-docs.ts",
41
+ "compare:sizes": "tsx scripts/compare-sizes.ts",
33
42
  "lint": "biome check .",
34
43
  "lint:fix": "biome check --write ."
35
44
  },
@@ -50,6 +59,7 @@
50
59
  "license": "MIT",
51
60
  "dependencies": {
52
61
  "dom-serializer": "^2.0.0",
62
+ "domhandler": "^5.0.3",
53
63
  "glob": "^10.3.10",
54
64
  "htmlparser2": "^9.1.0",
55
65
  "jsdom": "^27.0.1",
@@ -62,25 +72,30 @@
62
72
  "serialize-javascript": "^7.0.3",
63
73
  "diff": "^8.0.3",
64
74
  "playwright": "^1.60.0",
65
- "playwright-core": "^1.60.0"
75
+ "playwright-core": "^1.60.0",
76
+ "ws": "^8.21.0",
77
+ "minimatch": {
78
+ "brace-expansion": "^2.1.4"
79
+ }
66
80
  },
67
81
  "devDependencies": {
68
82
  "@biomejs/biome": "^2.3.10",
69
83
  "@types/chai": "^5.2.3",
70
84
  "@types/chai-as-promised": "^8.0.1",
85
+ "@types/css-tree": "^3.2.0",
71
86
  "@types/glob": "^8.1.0",
72
87
  "@types/gulp": "^4.0.18",
73
88
  "@types/gulp-csso": "^4.0.5",
74
89
  "@types/jsdom": "^21.1.6",
75
90
  "@types/mocha": "^10.0.10",
76
91
  "@types/node": "^20.12.11",
77
- "@types/path-browserify": "^1.0.1",
78
92
  "@types/trusted-types": "^2.0.7",
79
93
  "@types/yargs": "^17.0.29",
80
94
  "@web/test-runner": "^0.19.0",
81
95
  "@web/test-runner-playwright": "^0.11.1",
82
96
  "chai": "^5.3.3",
83
97
  "chai-as-promised": "^8.0.1",
98
+ "css-tree": "^3.2.1",
84
99
  "csso": "^5.0.5",
85
100
  "gulp": "^5.0.0",
86
101
  "gulp-csso": "^4.0.1",
@@ -90,8 +105,6 @@
90
105
  "ts-node": "^10.9.2",
91
106
  "tsdown": "^0.18.3",
92
107
  "tsec": "^0.2.8",
93
- "tsx": "^4.21.0",
94
- "typescript": "^5.9.3",
95
- "yargs": "^17.7.2"
108
+ "tsx": "^4.21.0"
96
109
  }
97
110
  }
package/.biomeignore DELETED
@@ -1,3 +0,0 @@
1
- dist/
2
- node_modules/
3
- .git/
@@ -1,109 +0,0 @@
1
- name: CI and Publish
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- tags:
8
- - "v*"
9
- pull_request:
10
- branches:
11
- - main
12
-
13
- permissions:
14
- contents: read
15
- pages: write
16
- id-token: write # Required for GitHub Pages and npm OIDC trusted publishing
17
-
18
- concurrency:
19
- group: ${{ github.workflow }}-${{ github.ref }}
20
- cancel-in-progress: true
21
-
22
- jobs:
23
- build-test:
24
- runs-on: ubuntu-latest
25
- name: Test and Build
26
- steps:
27
- - name: Checkout code
28
- uses: actions/checkout@v4
29
-
30
- - name: Setup Node.js
31
- uses: actions/setup-node@v4
32
- with:
33
- node-version: "24"
34
- registry-url: "https://registry.npmjs.org"
35
-
36
- - name: Install dependencies
37
- run: npm ci
38
-
39
- - name: Run lint/format check
40
- run: npm run lint
41
-
42
- - name: Install Playwright browsers
43
- run: npx playwright install
44
-
45
- - name: Run tests
46
- run: npm test
47
-
48
- - name: Build package
49
- run: npm run build
50
-
51
- - name: Upload build artifacts
52
- uses: actions/upload-artifact@v4
53
- with:
54
- name: build-artifacts
55
- path: dist/
56
-
57
- deploy-pages:
58
- needs: build-test
59
- runs-on: ubuntu-latest
60
- name: Deploy to GitHub Pages
61
- if: github.ref == 'refs/heads/main'
62
- environment:
63
- name: github-pages
64
- url: ${{ steps.deployment.outputs.page_url }}
65
- steps:
66
- - name: Download build artifacts
67
- uses: actions/download-artifact@v4
68
- with:
69
- name: build-artifacts
70
- path: dist/
71
-
72
- - name: Upload pages artifact
73
- uses: actions/upload-pages-artifact@v3
74
- with:
75
- path: "dist"
76
-
77
- - name: Deploy to GitHub Pages
78
- id: deployment
79
- uses: actions/deploy-pages@v4
80
-
81
- publish-npm:
82
- needs: build-test
83
- runs-on: ubuntu-latest
84
- name: Publish to NPM
85
- if: startsWith(github.ref, 'refs/tags/v')
86
- permissions:
87
- contents: read
88
- id-token: write # Required for npm OIDC trusted publishing
89
- steps:
90
- - name: Checkout code
91
- uses: actions/checkout@v4
92
-
93
- - name: Setup Node.js
94
- uses: actions/setup-node@v4
95
- with:
96
- node-version: "24"
97
- registry-url: "https://registry.npmjs.org"
98
-
99
- - name: Install dependencies
100
- run: npm ci
101
-
102
- - name: Download build artifacts
103
- uses: actions/download-artifact@v4
104
- with:
105
- name: build-artifacts
106
- path: dist/
107
-
108
- - name: Publish to NPM with provenance
109
- run: npm publish --provenance --access public
@@ -1,3 +0,0 @@
1
- {
2
- "recommendations": ["github.copilot"]
3
- }
@@ -1,34 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "name": "Mocha All",
9
- "type": "node",
10
- "request": "launch",
11
- "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
12
- "args": [
13
- "-r",
14
- "ts-node/register",
15
- "--no-timeouts",
16
- "--colors",
17
- "${workspaceFolder}/dist/**/*.test.ts"
18
- ],
19
- "console": "integratedTerminal",
20
- "internalConsoleOptions": "neverOpen",
21
- "skipFiles": ["<node_internals>/**/*.js"]
22
- },
23
- {
24
- "name": "Mocha Current File",
25
- "type": "node",
26
- "request": "launch",
27
- "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
28
- "args": ["-r", "ts-node/register", "--no-timeouts", "--colors", "${file}"],
29
- "console": "integratedTerminal",
30
- "internalConsoleOptions": "neverOpen",
31
- "skipFiles": ["<node_internals>/**/*.js"]
32
- }
33
- ]
34
- }
package/biome.json DELETED
@@ -1,46 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.4.6/schema.json",
3
- "vcs": {
4
- "enabled": true,
5
- "clientKind": "git",
6
- "useIgnoreFile": true
7
- },
8
- "files": {
9
- "ignoreUnknown": true,
10
- "includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.json"]
11
- },
12
- "formatter": {
13
- "enabled": true,
14
- "formatWithErrors": false,
15
- "indentStyle": "tab",
16
- "indentWidth": 2,
17
- "lineEnding": "lf",
18
- "lineWidth": 100,
19
- "attributePosition": "auto"
20
- },
21
- "linter": {
22
- "enabled": true,
23
- "rules": {
24
- "recommended": true,
25
- "complexity": {
26
- "noUselessTypeConstraint": "error"
27
- },
28
- "style": {
29
- "noNonNullAssertion": "error",
30
- "useConst": "error",
31
- "useImportType": "error"
32
- },
33
- "suspicious": {
34
- "noExplicitAny": "error",
35
- "useIterableCallbackReturn": "error"
36
- }
37
- }
38
- },
39
- "javascript": {
40
- "formatter": {
41
- "quoteStyle": "double",
42
- "trailingCommas": "all",
43
- "semicolons": "always"
44
- }
45
- }
46
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,yBAAyB;AACzB,OAAO,EAAE,cAAc,IAAI,yBAAyB,EAAE,CAAC;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,O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