@magic/transmute 0.0.56 → 0.0.58
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 +125 -53
- package/package.json +19 -19
- package/src/lib/index.js +4 -0
- package/src/renderers/{html.mjs → html.js} +1 -1
- package/src/renderers/index.js +2 -0
- package/src/lib/index.mjs +0 -4
- package/src/renderers/index.mjs +0 -2
- /package/src/bin/{handleArgv.mjs → handleArgv.js} +0 -0
- /package/src/bin/{index.mjs → index.js} +0 -0
- /package/src/bin/{runCli.mjs → runCli.js} +0 -0
- /package/src/{bin.mjs → bin.js} +0 -0
- /package/src/{index.mjs → index.js} +0 -0
- /package/src/lib/{escape.mjs → escape.js} +0 -0
- /package/src/lib/{findState.mjs → findState.js} +0 -0
- /package/src/lib/{implantState.mjs → implantState.js} +0 -0
- /package/src/lib/{stringDecode.mjs → stringDecode.js} +0 -0
- /package/src/renderers/{markdown.mjs → markdown.js} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
## @magic/transmute
|
|
2
|
+
|
|
2
3
|
transmutes html and markdown to @magic view fragments
|
|
3
4
|
|
|
4
5
|
[![NPM version][npm-image]][npm-url]
|
|
@@ -7,10 +8,10 @@ transmutes html and markdown to @magic view fragments
|
|
|
7
8
|
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
8
9
|
[![Known Vulnerabilities][snyk-image]][snyk-url]
|
|
9
10
|
|
|
10
|
-
|
|
11
11
|
### installation
|
|
12
12
|
|
|
13
13
|
#### cli:
|
|
14
|
+
|
|
14
15
|
```bash
|
|
15
16
|
npm i -g @magic/transmute
|
|
16
17
|
|
|
@@ -19,6 +20,7 @@ magic-transmute
|
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
#### javascript api
|
|
23
|
+
|
|
22
24
|
```bash
|
|
23
25
|
npm i --save @magic/transmute
|
|
24
26
|
```
|
|
@@ -30,40 +32,47 @@ npm i --save @magic/transmute
|
|
|
30
32
|
`magic-transmute --help`
|
|
31
33
|
|
|
32
34
|
#### commands:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
- markdown - convert markdown to magic functions
|
|
37
|
+
- html - convert html to magic functions
|
|
38
|
+
- file - convert file to magic functions
|
|
36
39
|
|
|
37
40
|
#### flags:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
|
|
42
|
+
- --add-wrapper - add export default[] to the returned string. - alias: ["--addWrapper"]
|
|
43
|
+
- --no-pretty - do not run prettier. - alias: ["--noPretty"]
|
|
44
|
+
- --markdown - force markdown parser to run. - alias: ["--mark", "-m"]
|
|
45
|
+
- --output - output file path - alias: ["--out", "-o"]
|
|
46
|
+
- --input - input file path - alias: ["--in", "-i"]
|
|
47
|
+
- --help - this help text - alias: ["-help", "help", "--h", "-h"]
|
|
48
|
+
- --str - an input string of either html or markdown, depending on running command
|
|
45
49
|
|
|
46
50
|
##### transpile html string:
|
|
51
|
+
|
|
47
52
|
`magic-transmute html --str '<a href="https://magic.github.io">magic!</a>'`
|
|
48
53
|
|
|
49
54
|
##### transpile markdown string:
|
|
55
|
+
|
|
50
56
|
`magic-transmute markdown --str '[magic!](https://magic.github.io)'`
|
|
51
57
|
|
|
52
58
|
##### html file:
|
|
59
|
+
|
|
53
60
|
`magic-transmute file --input input.html --output output.mjs`
|
|
54
61
|
|
|
55
62
|
##### markdown file
|
|
63
|
+
|
|
56
64
|
(.markdown and .md get recognized):
|
|
57
65
|
|
|
58
66
|
`magic-transmute file --input input.md --output output.mjs`
|
|
59
67
|
|
|
60
68
|
##### force markdown
|
|
69
|
+
|
|
61
70
|
(arbitrary file extensions)
|
|
62
71
|
|
|
63
72
|
`magic-transmute file --input input.txt --output output.mjs --markdown`
|
|
64
73
|
|
|
65
|
-
|
|
66
74
|
#### api examples
|
|
75
|
+
|
|
67
76
|
```javascript
|
|
68
77
|
import transmute from '@magic/transmute'
|
|
69
78
|
|
|
@@ -85,47 +94,60 @@ console.log(magic)
|
|
|
85
94
|
#### changelog
|
|
86
95
|
|
|
87
96
|
##### 0.0.1
|
|
97
|
+
|
|
88
98
|
first release
|
|
89
99
|
|
|
90
100
|
##### 0.0.2
|
|
101
|
+
|
|
91
102
|
update dependencies
|
|
92
103
|
|
|
93
104
|
##### 0.0.3
|
|
105
|
+
|
|
94
106
|
fix cli
|
|
95
107
|
|
|
96
108
|
##### 0.0.4
|
|
109
|
+
|
|
97
110
|
update @magic dependencies to use npm packages instead of github
|
|
98
111
|
|
|
99
112
|
##### 0.0.5
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
|
|
114
|
+
- extract state from html and markdown files
|
|
115
|
+
- allow usage of state variables in markdown and html
|
|
102
116
|
|
|
103
117
|
##### 0.0.6
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
118
|
+
|
|
119
|
+
- pass options from LexLex to marked.Lexer
|
|
120
|
+
- only implant state in html if it has not been passed as argument
|
|
121
|
+
- correctly camelCase object keys for html tags
|
|
122
|
+
- correctly merge passed state with in-file state for markdown and html
|
|
108
123
|
|
|
109
124
|
##### 0.0.7 - broken
|
|
125
|
+
|
|
110
126
|
remove commonjs support, node >= 13.5.0 required
|
|
111
127
|
|
|
112
128
|
##### 0.0.8
|
|
129
|
+
|
|
113
130
|
export correct cli file
|
|
114
131
|
|
|
115
132
|
##### 0.0.9
|
|
133
|
+
|
|
116
134
|
do not lowercase @magic-module names, some other minor changes
|
|
117
135
|
|
|
118
136
|
##### 0.0.10
|
|
137
|
+
|
|
119
138
|
do not wrap @magic-modules in p tags
|
|
120
139
|
|
|
121
140
|
##### 0.0.11
|
|
122
|
-
|
|
123
|
-
|
|
141
|
+
|
|
142
|
+
- remove eval from state injection function.
|
|
143
|
+
- correctly handle both ${} and {{}} variables in markdown and html files.
|
|
124
144
|
|
|
125
145
|
##### 0.0.12
|
|
146
|
+
|
|
126
147
|
state keys in ${} and {{ }} get trimmed... doh.
|
|
127
148
|
|
|
128
149
|
##### 0.0.13
|
|
150
|
+
|
|
129
151
|
return originalState, which is the state derived from the markdown/html file.
|
|
130
152
|
this allows @magic to use this state for individual pages when building them.
|
|
131
153
|
|
|
@@ -133,145 +155,196 @@ this allows @magic to use this state for individual pages when building them.
|
|
|
133
155
|
|
|
134
156
|
##### FULL @magic-module api available from markdown.
|
|
135
157
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
158
|
+
- nested state variables in template strings eg {{state.test.deep.var}} now work.
|
|
159
|
+
- replace parse5 with posthtml.
|
|
160
|
+
- custom markdown and custom html renderers added.
|
|
161
|
+
- @magic-modules in markdown and html can have keys that are arrays or objects now.
|
|
140
162
|
|
|
141
163
|
##### 0.0.15
|
|
164
|
+
|
|
142
165
|
if the value of a ${state.variable} in a template string is an array, this array gets join(' ')ed
|
|
143
166
|
|
|
144
167
|
##### 0.0.16
|
|
168
|
+
|
|
145
169
|
render/html: empty arrays and objects return an empty string.
|
|
146
170
|
|
|
147
171
|
##### 0.0.17
|
|
172
|
+
|
|
148
173
|
render/markdown.codespan: do not show linenumbers for codespans.
|
|
149
174
|
|
|
150
175
|
##### 0.0.18
|
|
151
|
-
|
|
152
|
-
|
|
176
|
+
|
|
177
|
+
- handle " escapes.
|
|
178
|
+
- string delimiters ', " AND ` in a string do not error, get escaped instead.
|
|
153
179
|
|
|
154
180
|
##### 0.0.19
|
|
155
|
-
|
|
181
|
+
|
|
182
|
+
- actually escape multiple html entities in a string, not just the first occurrence
|
|
156
183
|
|
|
157
184
|
##### 0.0.20
|
|
185
|
+
|
|
158
186
|
update dependencies
|
|
159
187
|
|
|
160
188
|
##### 0.0.21
|
|
189
|
+
|
|
161
190
|
update dependencies
|
|
162
191
|
|
|
163
192
|
##### 0.0.22
|
|
193
|
+
|
|
164
194
|
update prettier, @magic/cli
|
|
165
195
|
|
|
166
196
|
##### 0.0.23
|
|
197
|
+
|
|
167
198
|
Link and Img do not get wrapped in a paragraph (anymore)
|
|
168
199
|
|
|
169
200
|
##### 0.0.24
|
|
201
|
+
|
|
170
202
|
update marked and prettier
|
|
171
203
|
|
|
172
204
|
##### 0.0.25
|
|
205
|
+
|
|
173
206
|
update dependencies
|
|
174
207
|
|
|
175
208
|
##### 0.0.26
|
|
176
|
-
|
|
177
|
-
|
|
209
|
+
|
|
210
|
+
- bump required node version to 14.2.0
|
|
211
|
+
- update dependencies
|
|
178
212
|
|
|
179
213
|
##### 0.0.27
|
|
180
|
-
|
|
181
|
-
|
|
214
|
+
|
|
215
|
+
- update dependencies
|
|
216
|
+
- FIX: command line interface was broken.
|
|
182
217
|
|
|
183
218
|
##### 0.0.28
|
|
184
|
-
* update dependencies
|
|
185
|
-
* move magic-modules/no-spy to devDependencies
|
|
186
219
|
|
|
187
|
-
|
|
220
|
+
- update dependencies
|
|
221
|
+
- move magic-modules/no-spy to devDependencies
|
|
222
|
+
|
|
223
|
+
##### 0.0.29
|
|
224
|
+
|
|
188
225
|
update dependencies
|
|
189
226
|
|
|
190
|
-
##### 0.0.30
|
|
227
|
+
##### 0.0.30
|
|
228
|
+
|
|
191
229
|
update dependencies
|
|
192
230
|
|
|
193
231
|
##### 0.0.31
|
|
232
|
+
|
|
194
233
|
update dependencies
|
|
195
234
|
|
|
196
|
-
##### 0.0.32
|
|
235
|
+
##### 0.0.32
|
|
236
|
+
|
|
197
237
|
update dependencies
|
|
198
238
|
|
|
199
239
|
##### 0.0.33
|
|
200
|
-
* update dependencies
|
|
201
|
-
* fix markdown html handling changes
|
|
202
240
|
|
|
203
|
-
|
|
204
|
-
|
|
241
|
+
- update dependencies
|
|
242
|
+
- fix markdown html handling changes
|
|
243
|
+
|
|
244
|
+
##### 0.0.34
|
|
245
|
+
|
|
246
|
+
- update dependencies
|
|
247
|
+
|
|
248
|
+
##### 0.0.35
|
|
205
249
|
|
|
206
|
-
##### 0.0.35
|
|
207
250
|
update dependencies
|
|
208
251
|
|
|
209
|
-
##### 0.0.36
|
|
252
|
+
##### 0.0.36
|
|
253
|
+
|
|
210
254
|
update dependencies
|
|
211
255
|
|
|
212
256
|
##### 0.0.37
|
|
213
|
-
* bump required node version to 14.15.4
|
|
214
|
-
* update dependencies
|
|
215
257
|
|
|
216
|
-
|
|
258
|
+
- bump required node version to 14.15.4
|
|
259
|
+
- update dependencies
|
|
260
|
+
|
|
261
|
+
##### 0.0.38
|
|
262
|
+
|
|
217
263
|
update dependencies
|
|
218
264
|
|
|
219
|
-
##### 0.0.39
|
|
265
|
+
##### 0.0.39
|
|
266
|
+
|
|
220
267
|
update dependencies (marked)
|
|
221
268
|
|
|
222
269
|
##### 0.0.40
|
|
270
|
+
|
|
223
271
|
update dependencies (posthtml-parser)
|
|
224
272
|
|
|
225
273
|
##### 0.0.41
|
|
274
|
+
|
|
226
275
|
remove call to undefined cleanUrl from markdown.image
|
|
227
276
|
|
|
228
|
-
##### 0.0.42
|
|
277
|
+
##### 0.0.42
|
|
278
|
+
|
|
229
279
|
update dependencies
|
|
230
280
|
|
|
231
281
|
##### 0.0.43
|
|
232
|
-
|
|
233
|
-
|
|
282
|
+
|
|
283
|
+
- if the array returned by transmute has a length of 1, return that item instead
|
|
284
|
+
- update dependencies
|
|
234
285
|
|
|
235
286
|
##### 0.0.44
|
|
287
|
+
|
|
236
288
|
do return arrays in all cases. adapt tests to accomodate for that
|
|
237
289
|
|
|
238
|
-
##### 0.0.45
|
|
290
|
+
##### 0.0.45
|
|
291
|
+
|
|
239
292
|
update dependencies
|
|
240
293
|
|
|
241
294
|
##### 0.0.46
|
|
295
|
+
|
|
242
296
|
update dependencies to avoid circular dependencies in @magic/types
|
|
243
297
|
|
|
244
298
|
##### 0.0.47
|
|
299
|
+
|
|
245
300
|
update dependencies
|
|
246
301
|
|
|
247
302
|
##### 0.0.48
|
|
303
|
+
|
|
248
304
|
update dependencies
|
|
249
305
|
|
|
250
|
-
##### 0.0.49
|
|
306
|
+
##### 0.0.49
|
|
307
|
+
|
|
251
308
|
update dependencies
|
|
252
309
|
|
|
253
310
|
##### 0.0.50
|
|
311
|
+
|
|
254
312
|
update dependencies
|
|
255
313
|
|
|
256
314
|
##### 0.0.51
|
|
315
|
+
|
|
257
316
|
update dependencies
|
|
258
317
|
|
|
259
318
|
##### 0.0.52
|
|
319
|
+
|
|
260
320
|
update dependencies
|
|
261
321
|
|
|
262
322
|
##### 0.0.53
|
|
323
|
+
|
|
263
324
|
update dependencies
|
|
264
325
|
|
|
265
326
|
##### 0.0.54
|
|
327
|
+
|
|
266
328
|
update dependencies
|
|
267
329
|
|
|
268
330
|
##### 0.0.55
|
|
331
|
+
|
|
269
332
|
update dependencies
|
|
270
333
|
|
|
271
334
|
##### 0.0.56
|
|
335
|
+
|
|
336
|
+
update dependencies
|
|
337
|
+
|
|
338
|
+
##### 0.0.57
|
|
339
|
+
|
|
272
340
|
update dependencies
|
|
273
341
|
|
|
274
|
-
##### 0.0.
|
|
342
|
+
##### 0.0.58
|
|
343
|
+
|
|
344
|
+
- update dependencies
|
|
345
|
+
|
|
346
|
+
##### 0.0.59 - unreleased
|
|
347
|
+
|
|
275
348
|
...
|
|
276
349
|
|
|
277
350
|
[npm-image]: https://img.shields.io/npm/v/@magic/transmute.svg
|
|
@@ -284,4 +357,3 @@ update dependencies
|
|
|
284
357
|
[coveralls-url]: https://coveralls.io/github/magic/transmute
|
|
285
358
|
[snyk-image]: https://snyk.io/test/github/magic/transmute/badge.svg
|
|
286
359
|
[snyk-url]: https://snyk.io/test/github/magic/transmute
|
|
287
|
-
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/transmute",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
4
4
|
"author": "Wizards & Witches",
|
|
5
5
|
"homepage": "https://magic.github.io/transmute",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"description": "convert markdown and html to magic function strings.",
|
|
8
|
-
"main": "src/index.
|
|
8
|
+
"main": "src/index.js",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bin": {
|
|
11
|
-
"magic-transmute": "src/bin.
|
|
11
|
+
"magic-transmute": "src/bin.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"src"
|
|
@@ -31,28 +31,28 @@
|
|
|
31
31
|
"build": "NODE_ENV=production magic build",
|
|
32
32
|
"prod": "NODE_ENV=production magic build serve",
|
|
33
33
|
"dev": "magic dev",
|
|
34
|
-
"dirty-cli-test": "src/bin/bin.js file --input test/.data/testing.md --output testing.
|
|
34
|
+
"dirty-cli-test": "src/bin/bin.js file --input test/.data/testing.md --output testing.js && echo 'contents: ' && cat testing.js && echo 'deleting testing.js' && rm testing.js",
|
|
35
35
|
"calls": "calls"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@magic/cases": "0.0.
|
|
39
|
-
"@magic/cli": "0.0.
|
|
40
|
-
"@magic/entities": "0.0.
|
|
41
|
-
"@magic/log": "0.1.
|
|
42
|
-
"@magic/types": "0.1.
|
|
43
|
-
"marked": "
|
|
44
|
-
"posthtml-parser": "0.
|
|
45
|
-
"prettier": "
|
|
38
|
+
"@magic/cases": "0.0.13",
|
|
39
|
+
"@magic/cli": "0.0.53",
|
|
40
|
+
"@magic/entities": "0.0.17",
|
|
41
|
+
"@magic/log": "0.1.22",
|
|
42
|
+
"@magic/types": "0.1.37",
|
|
43
|
+
"marked": "18.0.5",
|
|
44
|
+
"posthtml-parser": "0.12.1",
|
|
45
|
+
"prettier": "3.8.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@magic-modules/git-badges": "0.0.12",
|
|
49
|
-
"@magic-modules/light-switch": "0.0.
|
|
50
|
-
"@magic-modules/no-spy": "0.0.
|
|
51
|
-
"@magic-modules/pre": "0.0.
|
|
52
|
-
"@magic-themes/docs": "0.0.
|
|
53
|
-
"@magic/core": "0.0.
|
|
54
|
-
"@magic/format": "0.0.
|
|
55
|
-
"@magic/test": "0.
|
|
49
|
+
"@magic-modules/light-switch": "0.0.12",
|
|
50
|
+
"@magic-modules/no-spy": "0.0.9",
|
|
51
|
+
"@magic-modules/pre": "0.0.12",
|
|
52
|
+
"@magic-themes/docs": "0.0.15",
|
|
53
|
+
"@magic/core": "0.0.158",
|
|
54
|
+
"@magic/format": "0.0.73",
|
|
55
|
+
"@magic/test": "0.3.12"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"magic",
|
package/src/lib/index.js
ADDED
package/src/lib/index.mjs
DELETED
package/src/renderers/index.mjs
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{bin.mjs → bin.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|