eleventy-auto-cache-buster 0.9.1 → 0.9.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/11tyAutoCacheBuster.js +5 -2
- package/README.md +16 -1
- package/package.json +7 -3
- package/pnpm-workspace.yaml +22 -0
package/11tyAutoCacheBuster.js
CHANGED
|
@@ -2,7 +2,10 @@ const fs = require("fs");
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const crypto = require("crypto");
|
|
4
4
|
const glob = require("glob");
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
const regexEscape = parseInt(process.versions.node.split(".")[0]) >= 24
|
|
7
|
+
? RegExp.escape
|
|
8
|
+
: require("escape-string-regexp").default;
|
|
6
9
|
|
|
7
10
|
let enableLogging = false;
|
|
8
11
|
let algorithm = "md5";
|
|
@@ -100,7 +103,7 @@ function replaceAssetsInFile(fileData, filePath, assetPathsAndHashes, writeFunc)
|
|
|
100
103
|
assetHash = assetHash.substring(0, hashTruncate);
|
|
101
104
|
}
|
|
102
105
|
// find and replace all instances of the asset URL
|
|
103
|
-
const assetPathRegexString =
|
|
106
|
+
const assetPathRegexString = regexEscape(assetPath);
|
|
104
107
|
const regexWithQueryString = new RegExp(`${assetPathRegexString}\\?`, 'g')
|
|
105
108
|
const regexWithoutQueryString = new RegExp(`${assetPathRegexString}(?!\\?)`, 'g')
|
|
106
109
|
const newOutputString = outputString
|
package/README.md
CHANGED
|
@@ -15,8 +15,9 @@ Into...
|
|
|
15
15
|
## How-to
|
|
16
16
|
### Getting started
|
|
17
17
|
1. Install the plugin
|
|
18
|
+
- pnpm: `pnpm install eleventy-auto-cache-buster`
|
|
18
19
|
- Yarn: `yarn add -D eleventy-auto-cache-buster`
|
|
19
|
-
-
|
|
20
|
+
- npm: `npm install --save-dev eleventy-auto-cache-buster`
|
|
20
21
|
2. Enable the plugin
|
|
21
22
|
```js
|
|
22
23
|
// .eleventy.js
|
|
@@ -54,6 +55,20 @@ module.exports = function (eleventyConfig) {
|
|
|
54
55
|
}
|
|
55
56
|
```
|
|
56
57
|
|
|
58
|
+
### Clone locally/dev
|
|
59
|
+
This requires git & Node.js to be installed
|
|
60
|
+
```bash
|
|
61
|
+
# Clone repository & enter directory
|
|
62
|
+
git clone https://github.com/Denperidge/eleventy-auto-cache-buster.git
|
|
63
|
+
cd eleventy-auto-cache-buster
|
|
64
|
+
|
|
65
|
+
# Prepare correct pnpm version
|
|
66
|
+
corepack enable
|
|
67
|
+
# Install dependencies
|
|
68
|
+
pnpm install
|
|
69
|
+
# Run tests
|
|
70
|
+
pnpm test
|
|
71
|
+
```
|
|
57
72
|
|
|
58
73
|
## License
|
|
59
74
|
This project is licensed under the [MIT License](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-auto-cache-buster",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Busts cache using ?v= with minimal configuration!",
|
|
5
5
|
"main": "11tyAutoCacheBuster.js",
|
|
6
6
|
"repository": "https://github.com/Denperidge/eleventy-auto-cache-buster.git",
|
|
7
7
|
"author": "Denperidge",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"packageManager": "pnpm@10.32.1+sha256.9b943b94bc8f55efb993aad8e44b538e6b091e60a9e4a944dcde869855f233e3",
|
|
9
13
|
"scripts": {
|
|
10
14
|
"start": "pushd tests/scenarios/8-sync@3 && eleventy && popd",
|
|
11
15
|
"test": "ava tests/test.mjs --timeout=30s"
|
|
12
16
|
},
|
|
13
17
|
"dependencies": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
18
|
+
"escape-string-regexp": "^5.0.0",
|
|
19
|
+
"glob": "^13.0.6"
|
|
16
20
|
},
|
|
17
21
|
"devDependencies": {
|
|
18
22
|
"@11ty/eleventy": "^3.1.2",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Minimum release age
|
|
2
|
+
# https://yarnpkg.com/configuration/yarnrc#npmMinimalAgeGate
|
|
3
|
+
minimumReleaseAge: 4320 # in minutes
|
|
4
|
+
minimumReleaseAgeExclude:
|
|
5
|
+
- undici@7.24.2
|
|
6
|
+
|
|
7
|
+
# Block install scripts
|
|
8
|
+
# https://pnpm.io/settings#strictdepbuilds
|
|
9
|
+
strictDepBuilds: true
|
|
10
|
+
|
|
11
|
+
# Block git repo/tarball sources for indirect dependencies
|
|
12
|
+
# https://pnpm.io/settings#blockexoticsubdeps
|
|
13
|
+
blockExoticSubdeps: true
|
|
14
|
+
|
|
15
|
+
# Don't install newer versions if security measures decreased
|
|
16
|
+
# https://pnpm.io/settings#trustpolicy
|
|
17
|
+
trustPolicy: no-downgrade
|
|
18
|
+
|
|
19
|
+
# Disable hoisting
|
|
20
|
+
# https://pnpm.io/blog/2020/10/17/node-modules-configuration-options-with-pnpm#a-strict-traditional-modules-directory
|
|
21
|
+
hoist: false
|
|
22
|
+
|