progressively-enhance-web-components 1.0.3 → 1.0.4
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
- Put your changes here...
|
|
6
6
|
|
|
7
|
+
## 1.0.4
|
|
8
|
+
|
|
9
|
+
- Fixed a bug that would cause the module to crash if the file list provided by the user wasn't a directory.
|
|
10
|
+
- Updated various dependencies.
|
|
11
|
+
|
|
7
12
|
## 1.0.3
|
|
8
13
|
|
|
9
14
|
- Fixed another bug that caused errors to print to the console if inline CSS existed in a scanned template.
|
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
progressively-enhance-web-components
|
|
2
2
|
===
|
|
3
3
|
|
|
4
|
-
[](https://github.com/rooseveltframework/progressively-enhance-web-components/actions?query=workflow%3ACI) [](https://www.npmjs.com/package/progressively-enhance-web-components)
|
|
5
6
|
|
|
6
7
|
A template file preprocessor for [progressively enhancing](https://en.wikipedia.org/wiki/Progressive_enhancement) web components in Node.js.
|
|
7
8
|
|
|
8
9
|
It works by reading a directory of HTML templates for your web application, identifying any web components, and replacing custom element invocations with fallback markup that will work if JavaScript is disabled which will then be progressively enhanced into the desired web component when the JavaScript loads.
|
|
9
10
|
|
|
10
|
-
This allows you to use web components in server-side templating the same way you would with client-side templating without creating a hard dependency on JavaScript for
|
|
11
|
+
This allows you to use web components in server-side templating the same way you would with client-side templating without creating a hard dependency on JavaScript for rendering templates with web components and without having to write two different templates for each context.
|
|
11
12
|
|
|
12
13
|
This module was built and is maintained by the [Roosevelt web framework](https://github.com/rooseveltframework/roosevelt) [team](https://github.com/orgs/rooseveltframework/people), but it can be used independently of Roosevelt as well.
|
|
13
14
|
|
|
@@ -33,7 +34,7 @@ Suppose the intended use of the `<word-count>` component looks like this:
|
|
|
33
34
|
|
|
34
35
|
And suppose also that you have an Express application with templates loaded into `mvc/views`.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
To leverage this module's progressive enhancement technique, you will need to define this component using a `<template>` element in any one of your templates as follows:
|
|
37
38
|
|
|
38
39
|
```html
|
|
39
40
|
<template id="word-count">
|
|
@@ -97,7 +98,7 @@ app.listen(port, () => {
|
|
|
97
98
|
})
|
|
98
99
|
```
|
|
99
100
|
|
|
100
|
-
*Note: The above example uses the [Teddy](https://github.com/rooseveltframework/teddy) templating system, but you can use any templating system you like
|
|
101
|
+
*Note: The above example uses the [Teddy](https://github.com/rooseveltframework/teddy) templating system, but you can use any templating system you like.*
|
|
101
102
|
|
|
102
103
|
In the above sample Express application, the `mvc/views` folder is copied to `mvc/.preprocessed_views`, then any template files in there will be updated to replace any uses of `<word-count>` with a more progressive enhancement-friendly version of `<word-count>` instead.
|
|
103
104
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://github.com/rooseveltframework/progressively-enhance-web-components/graphs/contributors"
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"version": "1.0.
|
|
11
|
+
"version": "1.0.4",
|
|
12
12
|
"homepage": "https://github.com/rooseveltframework/progressively-enhance-web-components",
|
|
13
13
|
"license": "CC-BY-4.0",
|
|
14
14
|
"main": "progressively-enhance-web-components.js",
|
|
@@ -5,7 +5,12 @@ const beautify = require('js-beautify').html
|
|
|
5
5
|
|
|
6
6
|
function loopThroughFilesSync (dir) {
|
|
7
7
|
let fileList = []
|
|
8
|
-
|
|
8
|
+
let files
|
|
9
|
+
try {
|
|
10
|
+
files = fs.readdirSync(dir, { withFileTypes: true })
|
|
11
|
+
} catch (err) {
|
|
12
|
+
return fileList
|
|
13
|
+
}
|
|
9
14
|
files.forEach(file => {
|
|
10
15
|
const filePath = path.join(dir, file.name)
|
|
11
16
|
if (file.isDirectory()) fileList = fileList.concat(loopThroughFilesSync(filePath)) // recurse dirs
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"express": "4.21.2",
|
|
10
10
|
"fs-extra": "11.3.0",
|
|
11
|
-
"teddy": "0.6.
|
|
11
|
+
"teddy": "0.6.26",
|
|
12
12
|
"webpack": "5.98.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"license": "MIT"
|
|
104
104
|
},
|
|
105
105
|
"node_modules/@types/node": {
|
|
106
|
-
"version": "22.13.
|
|
107
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.
|
|
108
|
-
"integrity": "sha512
|
|
106
|
+
"version": "22.13.10",
|
|
107
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz",
|
|
108
|
+
"integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==",
|
|
109
109
|
"license": "MIT",
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"undici-types": "~6.20.0"
|
|
@@ -283,9 +283,9 @@
|
|
|
283
283
|
}
|
|
284
284
|
},
|
|
285
285
|
"node_modules/acorn": {
|
|
286
|
-
"version": "8.14.
|
|
287
|
-
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.
|
|
288
|
-
"integrity": "sha512-
|
|
286
|
+
"version": "8.14.1",
|
|
287
|
+
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
|
|
288
|
+
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
|
|
289
289
|
"license": "MIT",
|
|
290
290
|
"bin": {
|
|
291
291
|
"acorn": "bin/acorn"
|
|
@@ -436,13 +436,13 @@
|
|
|
436
436
|
}
|
|
437
437
|
},
|
|
438
438
|
"node_modules/call-bound": {
|
|
439
|
-
"version": "1.0.
|
|
440
|
-
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.
|
|
441
|
-
"integrity": "sha512
|
|
439
|
+
"version": "1.0.4",
|
|
440
|
+
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
|
441
|
+
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
|
442
442
|
"license": "MIT",
|
|
443
443
|
"dependencies": {
|
|
444
|
-
"call-bind-apply-helpers": "^1.0.
|
|
445
|
-
"get-intrinsic": "^1.
|
|
444
|
+
"call-bind-apply-helpers": "^1.0.2",
|
|
445
|
+
"get-intrinsic": "^1.3.0"
|
|
446
446
|
},
|
|
447
447
|
"engines": {
|
|
448
448
|
"node": ">= 0.4"
|
|
@@ -452,9 +452,9 @@
|
|
|
452
452
|
}
|
|
453
453
|
},
|
|
454
454
|
"node_modules/caniuse-lite": {
|
|
455
|
-
"version": "1.0.
|
|
456
|
-
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.
|
|
457
|
-
"integrity": "sha512-
|
|
455
|
+
"version": "1.0.30001703",
|
|
456
|
+
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001703.tgz",
|
|
457
|
+
"integrity": "sha512-kRlAGTRWgPsOj7oARC9m1okJEXdL/8fekFVcxA8Hl7GH4r/sN4OJn/i6Flde373T50KS7Y37oFbMwlE8+F42kQ==",
|
|
458
458
|
"funding": [
|
|
459
459
|
{
|
|
460
460
|
"type": "opencollective",
|
|
@@ -696,9 +696,9 @@
|
|
|
696
696
|
"license": "MIT"
|
|
697
697
|
},
|
|
698
698
|
"node_modules/electron-to-chromium": {
|
|
699
|
-
"version": "1.5.
|
|
700
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.
|
|
701
|
-
"integrity": "sha512-
|
|
699
|
+
"version": "1.5.114",
|
|
700
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.114.tgz",
|
|
701
|
+
"integrity": "sha512-DFptFef3iktoKlFQK/afbo274/XNWD00Am0xa7M8FZUepHlHT8PEuiNBoRfFHbH1okqN58AlhbJ4QTkcnXorjA==",
|
|
702
702
|
"license": "ISC"
|
|
703
703
|
},
|
|
704
704
|
"node_modules/encodeurl": {
|
|
@@ -1707,9 +1707,9 @@
|
|
|
1707
1707
|
}
|
|
1708
1708
|
},
|
|
1709
1709
|
"node_modules/teddy": {
|
|
1710
|
-
"version": "0.6.
|
|
1711
|
-
"resolved": "https://registry.npmjs.org/teddy/-/teddy-0.6.
|
|
1712
|
-
"integrity": "sha512-
|
|
1710
|
+
"version": "0.6.26",
|
|
1711
|
+
"resolved": "https://registry.npmjs.org/teddy/-/teddy-0.6.26.tgz",
|
|
1712
|
+
"integrity": "sha512-DXbwYsyZW8Ki1tEez69NMr8PRCZsrDLiYCt3/KAXsicEjEiiJBfc5VOImnaGSjKetLC0vap9c6HFJFGT+pSQrw==",
|
|
1713
1713
|
"license": "CC-BY-4.0",
|
|
1714
1714
|
"dependencies": {
|
|
1715
1715
|
"cheerio": "1.0.0"
|
|
@@ -1740,9 +1740,9 @@
|
|
|
1740
1740
|
}
|
|
1741
1741
|
},
|
|
1742
1742
|
"node_modules/terser-webpack-plugin": {
|
|
1743
|
-
"version": "5.3.
|
|
1744
|
-
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.
|
|
1745
|
-
"integrity": "sha512-
|
|
1743
|
+
"version": "5.3.14",
|
|
1744
|
+
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
|
|
1745
|
+
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
|
|
1746
1746
|
"license": "MIT",
|
|
1747
1747
|
"dependencies": {
|
|
1748
1748
|
"@jridgewell/trace-mapping": "^0.3.25",
|
|
@@ -1829,9 +1829,9 @@
|
|
|
1829
1829
|
}
|
|
1830
1830
|
},
|
|
1831
1831
|
"node_modules/update-browserslist-db": {
|
|
1832
|
-
"version": "1.1.
|
|
1833
|
-
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.
|
|
1834
|
-
"integrity": "sha512-
|
|
1832
|
+
"version": "1.1.3",
|
|
1833
|
+
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
|
|
1834
|
+
"integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==",
|
|
1835
1835
|
"funding": [
|
|
1836
1836
|
{
|
|
1837
1837
|
"type": "opencollective",
|