pfwr 0.8.0 → 0.9.1
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/LICENSE +1 -1
- package/README.md +3 -3
- package/bin/cli.js +10 -57
- package/dist/index.js +57983 -24955
- package/package.json +27 -21
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/nikku/pfwr/actions/workflows/CI.yml)
|
|
4
4
|
|
|
5
|
-
Turns your [Markdown file](https://github.com/nikku/pfwr/blob/main/README.md#example) into [a beautiful HTML slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
5
|
+
Turns your [Markdown file](https://github.com/nikku/pfwr/blob/main/README.md#example) into [a beautiful HTML slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.9.1/example/presentation.html). Batteries included.
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
## Introduction
|
|
9
9
|
|
|
10
|
-
[](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
10
|
+
[](https://cdn.statically.io/gh/nikku/pfwr/v0.9.1/example/presentation.html)
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
@@ -74,7 +74,7 @@ Convert the file to an HTML file:
|
|
|
74
74
|
pfwr presentation.md presentation.html
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Open [the slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.
|
|
77
|
+
Open [the slide deck](https://cdn.statically.io/gh/nikku/pfwr/v0.9.1/example/presentation.html) in your favorite browser.
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
## Security Considerations
|
package/bin/cli.js
CHANGED
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import { pfwr } from '../dist/index.js';
|
|
4
4
|
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import process from 'node:process';
|
|
8
|
+
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
8
10
|
|
|
9
11
|
import mri from 'mri';
|
|
10
12
|
import opener from 'opener';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
import { debounce } from 'min-dash';
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
14
18
|
|
|
15
19
|
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'));
|
|
16
20
|
|
|
@@ -33,7 +37,7 @@ if (args.version) {
|
|
|
33
37
|
|
|
34
38
|
if (args.help) {
|
|
35
39
|
console.log(
|
|
36
|
-
`
|
|
40
|
+
`
|
|
37
41
|
Usage: pfwr input.md [output.html]
|
|
38
42
|
|
|
39
43
|
Options:
|
|
@@ -84,57 +88,6 @@ function defaultOutput(inputFile) {
|
|
|
84
88
|
return path.join(path.dirname(inputFile), path.basename(inputFile, '.md') + '.html');
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
/**
|
|
88
|
-
* Debounce fn, calling it only once if
|
|
89
|
-
* the given time elapsed between calls.
|
|
90
|
-
*
|
|
91
|
-
* @param {Function} fn
|
|
92
|
-
* @param {Number} timeout
|
|
93
|
-
*
|
|
94
|
-
* @return {Function} debounced function
|
|
95
|
-
*/
|
|
96
|
-
function debounce(fn, timeout) {
|
|
97
|
-
|
|
98
|
-
var timer;
|
|
99
|
-
|
|
100
|
-
var lastArgs;
|
|
101
|
-
var lastThis;
|
|
102
|
-
|
|
103
|
-
var lastNow;
|
|
104
|
-
|
|
105
|
-
function fire() {
|
|
106
|
-
|
|
107
|
-
var now = Date.now();
|
|
108
|
-
|
|
109
|
-
var scheduledDiff = (lastNow + timeout) - now;
|
|
110
|
-
|
|
111
|
-
if (scheduledDiff > 0) {
|
|
112
|
-
return schedule(scheduledDiff);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
fn.apply(lastThis, lastArgs);
|
|
116
|
-
|
|
117
|
-
timer = lastNow = lastArgs = lastThis = undefined;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function schedule(timeout) {
|
|
121
|
-
timer = setTimeout(fire, timeout);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return function(...args) {
|
|
125
|
-
|
|
126
|
-
lastNow = Date.now();
|
|
127
|
-
|
|
128
|
-
lastArgs = args;
|
|
129
|
-
lastThis = this;
|
|
130
|
-
|
|
131
|
-
// ensure an execution is scheduled
|
|
132
|
-
if (!timer) {
|
|
133
|
-
schedule(timeout);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
91
|
// do actual work
|
|
139
92
|
|
|
140
93
|
function noop() { }
|