asciidoc-editor 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -8,6 +8,17 @@ edited underneath.
8
8
  Parsing and rendering are [`asciidoc-parser`] and [`asciidoc-html5`]; the
9
9
  interface is [Leptos].
10
10
 
11
+ <!--
12
+ Absolute, not relative: this README is copied into the npm package, and
13
+ npmjs.com cannot resolve a path into the repository. And media., not raw.,
14
+ because the screenshot is held in git-lfs — raw.githubusercontent.com hands
15
+ back the pointer file rather than the image.
16
+ -->
17
+ ![The editor showing a rendered AsciiDoc document — a title, a table of
18
+ contents, headings, a list, a code block and a table — with the formatting
19
+ toolbar above
20
+ it.](https://media.githubusercontent.com/media/AlexanderThaller/asciidoc-editor/main/docs/screenshot.png)
21
+
11
22
  ## Using it in a page
12
23
 
13
24
  ```sh
@@ -85,13 +96,37 @@ python3 -m http.server 8000
85
96
 
86
97
  ### Publishing
87
98
 
99
+ Releases go out from CI, which needs no token and no second factor: npm trusts
100
+ `.github/workflows/release.yml` by name and the runner proves it is that
101
+ workflow with an OIDC token.
102
+
88
103
  ```sh
89
- ./build-package.sh
90
- npm publish ./pkg
104
+ git tag v0.1.1 && git push origin v0.1.1
91
105
  ```
92
106
 
93
- The leading `./` matters: `npm publish pkg` reads `pkg` as the name of a
94
- package on the registry and tries to publish that one.
107
+ The workflow refuses to publish if the tag and the version in `Cargo.toml`
108
+ disagree.
109
+
110
+ Setting that trust up is a one-off, and it has an awkward first step: npm will
111
+ only configure a trusted publisher for a package that already exists, so the
112
+ very first release has to be published by hand.
113
+
114
+ 1. `./build-package.sh && npm publish ./pkg` — the leading `./` matters, since
115
+ `npm publish pkg` reads `pkg` as the name of a package on the registry and
116
+ tries to publish that one. Publishing by hand needs 2FA on the account: npm
117
+ now accepts only a security key, added at
118
+ `npmjs.com/settings/<user>/tfa`.
119
+ 2. On the package's settings page at npmjs.com, add a trusted publisher: this
120
+ repository, workflow `release.yml`.
121
+ 3. Every release after that is the tag above.
122
+
123
+ The trusted publisher is a record against the package, not against the
124
+ repository, and `npm publish` fails with "package not found" when it is
125
+ missing — whatever the package's own state. `npm trust list asciidoc-editor`
126
+ shows it; `npm trust github asciidoc-editor --file release.yml --repo
127
+ AlexanderThaller/asciidoc-editor --allow-publish` creates it. The publish
128
+ grant is not implied, and the environment must be left unset, because the
129
+ workflow declares none.
95
130
 
96
131
  ## Licence
97
132
 
@@ -99,11 +134,24 @@ MIT. See `LICENSE`.
99
134
 
100
135
  ## Developing
101
136
 
137
+ Every tool this needs is in the flake, pinned by `flake.lock` — the same
138
+ compiler, generator and optimiser here as in CI:
139
+
102
140
  ```sh
141
+ nix develop
103
142
  trunk serve # the editor on its own at http://localhost:8080
104
143
  cargo test # the source-editing and parsing logic
105
144
  ```
106
145
 
146
+ With direnv, `direnv allow` enters it for you. Without Nix it still builds from
147
+ whatever is on PATH, so long as `wasm-bindgen` matches the version in
148
+ `Cargo.lock` — `build-package.sh` refuses to run when it does not, because a
149
+ mismatch yields a module the browser rejects at load.
150
+
151
+ That pin runs the other way too: `wasm-bindgen` is held at an exact version in
152
+ `Cargo.toml` because it has to match the CLI nixpkgs provides. Moving one means
153
+ moving both.
154
+
107
155
  `trunk serve` runs `src/main.rs`, which is the same library mounted onto a bare
108
156
  page.
109
157
 
@@ -97,13 +97,14 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
97
97
  export interface InitOutput {
98
98
  readonly memory: WebAssembly.Memory;
99
99
  readonly __wbg_editor_free: (a: number, b: number) => void;
100
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
101
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
102
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
103
100
  readonly editor_destroy: (a: number) => void;
104
101
  readonly editor_onChange: (a: number, b: any) => void;
105
102
  readonly editor_setValue: (a: number, b: number, c: number) => void;
106
103
  readonly editor_value: (a: number) => [number, number];
104
+ readonly mount: (a: any, b: number) => [number, number, number];
105
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
106
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
107
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
107
108
  readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
108
109
  readonly intounderlyingbytesource_cancel: (a: number) => void;
109
110
  readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
@@ -114,18 +115,17 @@ export interface InitOutput {
114
115
  readonly intounderlyingsink_write: (a: number, b: any) => any;
115
116
  readonly intounderlyingsource_cancel: (a: number) => void;
116
117
  readonly intounderlyingsource_pull: (a: number, b: any) => any;
117
- readonly mount: (a: any, b: number) => [number, number, number];
118
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___js_sys_b5492ab1ec297925___Function_fn_wasm_bindgen_56bfa123189e575a___JsValue_____wasm_bindgen_56bfa123189e575a___sys__Undefined___js_sys_b5492ab1ec297925___Function_fn_wasm_bindgen_56bfa123189e575a___JsValue_____wasm_bindgen_56bfa123189e575a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
119
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___wasm_bindgen_56bfa123189e575a___JsValue__core_dcdb5b26ee14507c___result__Result_____wasm_bindgen_56bfa123189e575a___JsError___true_: (a: number, b: number, c: any) => [number, number];
120
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___wasm_bindgen_56bfa123189e575a___JsValue______true_: (a: number, b: number, c: any) => void;
121
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___wasm_bindgen_56bfa123189e575a___JsValue______true__20: (a: number, b: number, c: any) => void;
122
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___web_sys_7d5907b0b8adcf95___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
123
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___web_sys_7d5907b0b8adcf95___features__gen_DragEvent__DragEvent______true_: (a: number, b: number, c: any) => void;
124
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___web_sys_7d5907b0b8adcf95___features__gen_DragEvent__DragEvent______true__19: (a: number, b: number, c: any) => void;
125
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___web_sys_7d5907b0b8adcf95___features__gen_DragEvent__DragEvent______true__22: (a: number, b: number, c: any) => void;
126
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke___web_sys_7d5907b0b8adcf95___features__gen_DragEvent__DragEvent______true__23: (a: number, b: number, c: any) => void;
127
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke_______true_: (a: number, b: number) => void;
128
- readonly wasm_bindgen_56bfa123189e575a___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
118
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___wasm_bindgen_c467f9011b18c78b___JsValue__core_83f2c1a17d31e451___result__Result_____wasm_bindgen_c467f9011b18c78b___JsError___true_: (a: number, b: number, c: any) => [number, number];
119
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___js_sys_8529a515a58b8dfc___Function_fn_wasm_bindgen_c467f9011b18c78b___JsValue_____wasm_bindgen_c467f9011b18c78b___sys__Undefined___js_sys_8529a515a58b8dfc___Function_fn_wasm_bindgen_c467f9011b18c78b___JsValue_____wasm_bindgen_c467f9011b18c78b___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
120
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___wasm_bindgen_c467f9011b18c78b___JsValue______true_: (a: number, b: number, c: any) => void;
121
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___web_sys_32935426f250c96f___features__gen_DragEvent__DragEvent______true_: (a: number, b: number, c: any) => void;
122
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___web_sys_32935426f250c96f___features__gen_DragEvent__DragEvent______true__3: (a: number, b: number, c: any) => void;
123
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___wasm_bindgen_c467f9011b18c78b___JsValue______true__4: (a: number, b: number, c: any) => void;
124
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___web_sys_32935426f250c96f___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
125
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___web_sys_32935426f250c96f___features__gen_DragEvent__DragEvent______true__6: (a: number, b: number, c: any) => void;
126
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke___web_sys_32935426f250c96f___features__gen_DragEvent__DragEvent______true__7: (a: number, b: number, c: any) => void;
127
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
128
+ readonly wasm_bindgen_c467f9011b18c78b___convert__closures_____invoke_______true_: (a: number, b: number) => void;
129
129
  readonly __wbindgen_malloc: (a: number, b: number) => number;
130
130
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
131
131
  readonly __externref_table_alloc: () => number;