@jamesblanksby/toolkit 1.0.0 → 1.1.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/build/shopify.js CHANGED
@@ -8,10 +8,10 @@ const { PWD, } = process.env;
8
8
 
9
9
  function flattenAsset(file, type) {
10
10
  const name = path.relative(PWD, file.path)
11
- .replace(new RegExp(`^src\/${type}\/?`), '')
12
- .replace(/\//g, '_');
11
+ .replace(new RegExp(`src/${type}/?`), '')
12
+ .replace(new RegExp('/', 'g'), '_');
13
13
 
14
- return new MemoryFile(name, file.contents);
14
+ return new MemoryFile(name, file.buffer);
15
15
  }
16
16
 
17
17
  function flattenCss(file) {
@@ -22,9 +22,9 @@ function flattenCss(file) {
22
22
  const name = `${path.basename(file.path)}.liquid`;
23
23
 
24
24
  const result = file.contents
25
- .replace(/\.\.\/(font|gfx)\//g, '')
26
- .replace(/url\((.*?)\)/g, (_, match) => {
27
- const resource = match.replace(/\//g, '_');
25
+ .replace(new RegExp('../(font|gfx)/', 'g'), '')
26
+ .replace(new RegExp('url\\((.*?)\\)', 'g'), (_, match) => {
27
+ const resource = match.replace(new RegExp('/', 'g'), '_');
28
28
  return `url({{ '${resource}' | asset_url }})`;
29
29
  });
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamesblanksby/toolkit",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,17 +16,16 @@
16
16
  "toolkit": "bin/toolkit.js"
17
17
  },
18
18
  "dependencies": {
19
- "browser-sync": "^3.0.2",
19
+ "browser-sync": "^3.0.3",
20
20
  "chalk": "^5.3.0",
21
- "chokidar": "^3.6.0",
22
- "cssnano": "^6.0.3",
23
- "eslint": "^8.57.0",
21
+ "chokidar": "3.6.0",
22
+ "cssnano": "^7.0.6",
23
+ "eslint": "^9.13.0",
24
24
  "fast-glob": "^3.3.2",
25
- "minimatch": "^9.0.3",
26
- "postcss-preset-env": "^9.3.0",
27
- "postcss": "^8.4.35",
28
- "sass": "^1.70.0",
29
- "uglify-js": "^3.17.4"
25
+ "postcss": "^8.4.47",
26
+ "postcss-preset-env": "^10.0.7",
27
+ "sass": "1.79.6",
28
+ "uglify-js": "^3.19.3"
30
29
  },
31
30
  "browserslist": [
32
31
  "> 0.25% and not dead"
package/src/file.js CHANGED
@@ -28,7 +28,7 @@ class MemoryFile extends File {
28
28
  constructor(path, contents) {
29
29
  super(path);
30
30
 
31
- this.#buffer = typeof buffer === 'string' ? Buffer.from(contents) : contents;
31
+ this.#buffer = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
32
32
  }
33
33
 
34
34
  get buffer() {
@@ -46,8 +46,8 @@ class MemoryFile extends File {
46
46
 
47
47
  class DiskFile extends File {
48
48
  async read() {
49
- const buffer = await fs.readFile(this.path);
50
- return new MemoryFile(this.path, buffer);
49
+ const contents = await fs.readFile(this.path);
50
+ return new MemoryFile(this.path, contents);
51
51
  }
52
52
  }
53
53