@squoosh-kit/vite-plugin 0.1.2 → 0.1.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAC,OAAO,UAAU,iBAAiB;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;gDA8CxB;wBAAE,IAAI,CAAC,EAAE,MAAM,CAAA;qBAAE;;;;;;EA2DxD"}
|
package/dist/index.js
CHANGED
|
@@ -29,21 +29,29 @@ function copyBrowserFiles(srcDir, destDir) {
|
|
|
29
29
|
cpSync(wasmDir, destWasmDir, { recursive: true });
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function squooshVitePlugin() {
|
|
32
|
+
function squooshVitePlugin(squooshKitRoot) {
|
|
33
|
+
const viteRoot = process.cwd();
|
|
34
|
+
const publicDir = join(viteRoot, "public", "squoosh-kit");
|
|
35
|
+
const webpDist = join(squooshKitRoot, "webp", "dist");
|
|
36
|
+
const resizeDist = join(squooshKitRoot, "resize", "dist");
|
|
33
37
|
return {
|
|
34
38
|
name: "squoosh-vite-plugin",
|
|
35
39
|
buildStart() {
|
|
36
40
|
console.log("Copying Squoosh browser assets...");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
console.log("squooshKitRoot", squooshKitRoot);
|
|
42
|
+
console.log("viteRoot", viteRoot);
|
|
43
|
+
console.log("publicDir", publicDir);
|
|
44
|
+
console.log("webpDist", webpDist);
|
|
45
|
+
console.log("resizeDist", resizeDist);
|
|
42
46
|
if (existsSync(publicDir)) {
|
|
43
47
|
rmSync(publicDir, { recursive: true, force: true });
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
if (existsSync(webpDist)) {
|
|
50
|
+
copyBrowserFiles(webpDist, join(publicDir, "webp"));
|
|
51
|
+
}
|
|
52
|
+
if (existsSync(resizeDist)) {
|
|
53
|
+
copyBrowserFiles(resizeDist, join(publicDir, "resize"));
|
|
54
|
+
}
|
|
47
55
|
console.log("Squoosh assets copied successfully!");
|
|
48
56
|
},
|
|
49
57
|
config: () => ({
|
package/package.json
CHANGED