nuxt-content-assets 1.3.1 → 1.3.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/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "1.3.1"
7
+ "version": "1.3.2"
8
8
  }
package/dist/module.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import * as Fs from 'fs';
2
- import * as Path from 'path';
3
- import Path__default from 'path';
1
+ import Fs from 'fs';
2
+ import Path from 'crosspath';
4
3
  import { useNuxt, createResolver, defineNuxtModule, addPlugin } from '@nuxt/kit';
5
4
  import { visit, SKIP, CONTINUE } from 'unist-util-visit';
6
5
  import { listen } from 'listhen';
@@ -52,7 +51,7 @@ function isExcluded(path) {
52
51
  return path.split("/").some((segment) => segment.startsWith(".") || segment.startsWith("_"));
53
52
  }
54
53
  function isImage(path) {
55
- const ext = Path__default.extname(path).substring(1);
54
+ const ext = Path.extname(path).substring(1);
56
55
  return extensions.image.includes(ext);
57
56
  }
58
57
  function isArticle(path) {
@@ -388,7 +387,7 @@ function makeSourceManager(key, source, publicPath, callback) {
388
387
  function makeAssetsManager(publicPath) {
389
388
  const indexKey = "assets.json";
390
389
  const storage = makeSourceStorage(Path.join(publicPath, ".."));
391
- storage.watch(async (event, key) => {
390
+ void storage.watch(async (event, key) => {
392
391
  if (event === "update" && key === indexKey) {
393
392
  await load();
394
393
  }
@@ -399,7 +398,7 @@ function makeAssetsManager(publicPath) {
399
398
  Object.assign(assets, data || {});
400
399
  }
401
400
  const save = debounce(function() {
402
- storage.setItem(indexKey, assets);
401
+ void storage.setItem(indexKey, assets);
403
402
  }, 50);
404
403
  function resolveAsset(content, relAsset, registerContent = false) {
405
404
  const srcDir = Path.dirname(content._file);
@@ -1,4 +1,4 @@
1
- import * as Path from "path";
1
+ import Path from "crosspath";
2
2
  import getImageSize from "image-size";
3
3
  import debounce from "debounce";
4
4
  import { hash } from "ohash";
@@ -7,7 +7,7 @@ import { isImage, warn, log } from "../utils/index.mjs";
7
7
  export function makeAssetsManager(publicPath) {
8
8
  const indexKey = "assets.json";
9
9
  const storage = makeSourceStorage(Path.join(publicPath, ".."));
10
- storage.watch(async (event, key) => {
10
+ void storage.watch(async (event, key) => {
11
11
  if (event === "update" && key === indexKey) {
12
12
  await load();
13
13
  }
@@ -18,7 +18,7 @@ export function makeAssetsManager(publicPath) {
18
18
  Object.assign(assets, data || {});
19
19
  }
20
20
  const save = debounce(function() {
21
- storage.setItem(indexKey, assets);
21
+ void storage.setItem(indexKey, assets);
22
22
  }, 50);
23
23
  function resolveAsset(content, relAsset, registerContent = false) {
24
24
  const srcDir = Path.dirname(content._file);
@@ -1,4 +1,4 @@
1
- import * as Path from "path";
1
+ import Path from "crosspath";
2
2
  import githubDriver from "unstorage/drivers/github";
3
3
  import fsDriver from "unstorage/drivers/fs";
4
4
  import { createStorage } from "unstorage";
@@ -1,5 +1,5 @@
1
- import * as Path from "path";
2
- import * as Fs from "fs";
1
+ import Path from "crosspath";
2
+ import Fs from "fs";
3
3
  export function readFile(path, asJson = false) {
4
4
  const text = Fs.readFileSync(path, { encoding: "utf8" });
5
5
  return asJson ? JSON.parse(text) : text;
@@ -1,4 +1,4 @@
1
- import Path from "path";
1
+ import Path from "crosspath";
2
2
  import { extensions } from "./config.mjs";
3
3
  export function parseQuery(path) {
4
4
  const matches = path.match(/\?.+$/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-content-assets",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Enable locally-located assets in Nuxt Content",
5
5
  "repository": "davestewart/nuxt-content-assets",
6
6
  "license": "MIT",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@nuxt/kit": "^3.3.2",
35
+ "crosspath": "^2.0.0",
35
36
  "debounce": "^1.2.1",
36
37
  "image-size": "^1.0.2",
37
38
  "listhen": "^1.0.4",
@@ -41,7 +42,7 @@
41
42
  "ws": "^8.13.0"
42
43
  },
43
44
  "peerDependencies": {
44
- "@nuxt/content": ">=2.6 || <3.0.0"
45
+ "@nuxt/content": "^2.0.0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@nuxt/eslint-config": "^0.1.1",