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.
Files changed (5) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -3
  3. package/bin/cli.js +10 -57
  4. package/dist/index.js +57983 -24955
  5. package/package.json +27 -21
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Nico Rehwaldt
3
+ Copyright (c) 2021-present Nico Rehwaldt
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  [![CI](https://github.com/nikku/pfwr/actions/workflows/CI.yml/badge.svg)](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.8.0/example/presentation.html). Batteries included.
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
- [![Slide deck generated from Markdown via pfwr](https://raw.githubusercontent.com/nikku/pfwr/main/docs/screenshot.png)](https://cdn.statically.io/gh/nikku/pfwr/v0.8.0/example/presentation.html)
10
+ [![Slide deck generated from Markdown via pfwr](https://raw.githubusercontent.com/nikku/pfwr/main/docs/screenshot.png)](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.8.0/example/presentation.html) in your favorite browser.
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 { fileURLToPath } from 'url'
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
- const __filename = fileURLToPath(import.meta.url)
13
- const __dirname = path.dirname(__filename)
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() { }