astro 2.2.2 → 2.2.3

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.
Files changed (38) hide show
  1. package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.wasm.d.ts +3 -0
  2. package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.wasm.js +4 -0
  3. package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.wasm.d.ts +3 -0
  4. package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.wasm.js +4 -0
  5. package/dist/assets/services/vendor/squoosh/codecs.js +24 -25
  6. package/dist/assets/services/vendor/squoosh/emscripten-utils.d.ts +2 -2
  7. package/dist/assets/services/vendor/squoosh/emscripten-utils.js +6 -8
  8. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.wasm.d.ts +3 -0
  9. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.wasm.js +4 -0
  10. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.wasm.d.ts +3 -0
  11. package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.wasm.js +4 -0
  12. package/dist/assets/services/vendor/squoosh/png/squoosh_oxipng_bg.wasm.d.ts +3 -0
  13. package/dist/assets/services/vendor/squoosh/png/squoosh_oxipng_bg.wasm.js +4 -0
  14. package/dist/assets/services/vendor/squoosh/png/squoosh_png_bg.wasm.d.ts +3 -0
  15. package/dist/assets/services/vendor/squoosh/png/squoosh_png_bg.wasm.js +4 -0
  16. package/dist/assets/services/vendor/squoosh/resize/squoosh_resize_bg.wasm.d.ts +3 -0
  17. package/dist/assets/services/vendor/squoosh/resize/squoosh_resize_bg.wasm.js +4 -0
  18. package/dist/assets/services/vendor/squoosh/rotate/rotate.wasm.d.ts +3 -0
  19. package/dist/assets/services/vendor/squoosh/rotate/rotate.wasm.js +4 -0
  20. package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.wasm.d.ts +3 -0
  21. package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.wasm.js +4 -0
  22. package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.wasm.d.ts +3 -0
  23. package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.wasm.js +4 -0
  24. package/dist/assets/vite-plugin-assets.js +0 -10
  25. package/dist/content/index.d.ts +1 -0
  26. package/dist/content/index.js +3 -0
  27. package/dist/content/vite-plugin-content-assets.js +33 -34
  28. package/dist/content/vite-plugin-content-imports.js +17 -23
  29. package/dist/core/build/generate.js +0 -4
  30. package/dist/core/build/plugins/plugin-css.js +7 -9
  31. package/dist/core/constants.js +1 -1
  32. package/dist/core/dev/dev.js +1 -1
  33. package/dist/core/messages.js +2 -2
  34. package/dist/runtime/server/render/slot.js +1 -1
  35. package/dist/vite-plugin-jsx/index.js +7 -0
  36. package/package.json +1 -1
  37. package/dist/assets/services/vendor/squoosh/copy-wasm.d.ts +0 -2
  38. package/dist/assets/services/vendor/squoosh/copy-wasm.js +0 -37
@@ -1,27 +1,26 @@
1
- import { promises as fsp } from "node:fs";
2
- import { getModuleURL, instantiateEmscriptenWasm, pathify } from "./emscripten-utils.js";
3
- import mozEnc from "./mozjpeg/mozjpeg_node_enc.js";
4
- const mozEncWasm = new URL("./mozjpeg/mozjpeg_node_enc.wasm", getModuleURL(import.meta.url));
1
+ import { instantiateEmscriptenWasm } from "./emscripten-utils.js";
5
2
  import mozDec from "./mozjpeg/mozjpeg_node_dec.js";
6
- const mozDecWasm = new URL("./mozjpeg/mozjpeg_node_dec.wasm", getModuleURL(import.meta.url));
7
- import webpEnc from "./webp/webp_node_enc.js";
8
- const webpEncWasm = new URL("./webp/webp_node_enc.wasm", getModuleURL(import.meta.url));
3
+ import mozDecWasm from "./mozjpeg/mozjpeg_node_dec.wasm.js";
4
+ import mozEnc from "./mozjpeg/mozjpeg_node_enc.js";
5
+ import mozEncWasm from "./mozjpeg/mozjpeg_node_enc.wasm.js";
9
6
  import webpDec from "./webp/webp_node_dec.js";
10
- const webpDecWasm = new URL("./webp/webp_node_dec.wasm", getModuleURL(import.meta.url));
11
- import avifEnc from "./avif/avif_node_enc.js";
12
- const avifEncWasm = new URL("./avif/avif_node_enc.wasm", getModuleURL(import.meta.url));
7
+ import webpDecWasm from "./webp/webp_node_dec.wasm.js";
8
+ import webpEnc from "./webp/webp_node_enc.js";
9
+ import webpEncWasm from "./webp/webp_node_enc.wasm.js";
13
10
  import avifDec from "./avif/avif_node_dec.js";
14
- const avifDecWasm = new URL("./avif/avif_node_dec.wasm", getModuleURL(import.meta.url));
11
+ import avifDecWasm from "./avif/avif_node_dec.wasm.js";
12
+ import avifEnc from "./avif/avif_node_enc.js";
13
+ import avifEncWasm from "./avif/avif_node_enc.wasm.js";
15
14
  import * as pngEncDec from "./png/squoosh_png.js";
16
- const pngEncDecWasm = new URL("./png/squoosh_png_bg.wasm", getModuleURL(import.meta.url));
17
- const pngEncDecInit = () => pngEncDec.default(fsp.readFile(pathify(pngEncDecWasm.toString())));
15
+ import pngEncDecWasm from "./png/squoosh_png_bg.wasm.js";
16
+ const pngEncDecInit = () => pngEncDec.default(pngEncDecWasm);
18
17
  import * as oxipng from "./png/squoosh_oxipng.js";
19
- const oxipngWasm = new URL("./png/squoosh_oxipng_bg.wasm", getModuleURL(import.meta.url));
20
- const oxipngInit = () => oxipng.default(fsp.readFile(pathify(oxipngWasm.toString())));
18
+ import oxipngWasm from "./png/squoosh_oxipng_bg.wasm.js";
19
+ const oxipngInit = () => oxipng.default(oxipngWasm);
21
20
  import * as resize from "./resize/squoosh_resize.js";
22
- const resizeWasm = new URL("./resize/squoosh_resize_bg.wasm", getModuleURL(import.meta.url));
23
- const resizeInit = () => resize.default(fsp.readFile(pathify(resizeWasm.toString())));
24
- const rotateWasm = new URL("./rotate/rotate.wasm", getModuleURL(import.meta.url));
21
+ import resizeWasm from "./resize/squoosh_resize_bg.wasm.js";
22
+ const resizeInit = () => resize.default(resizeWasm);
23
+ import rotateWasm from "./rotate/rotate.wasm.js";
25
24
  import ImageData from "./image_data.js";
26
25
  global.ImageData = ImageData;
27
26
  function resizeNameToIndex(name) {
@@ -108,7 +107,7 @@ const preprocessors = {
108
107
  const degrees = numRotations * 90 % 360;
109
108
  const sameDimensions = degrees === 0 || degrees === 180;
110
109
  const size = width * height * 4;
111
- const instance = (await WebAssembly.instantiate(await fsp.readFile(pathify(rotateWasm.toString())))).instance;
110
+ const instance = (await WebAssembly.instantiate(rotateWasm)).instance;
112
111
  const { memory } = instance.exports;
113
112
  const additionalPagesNeeded = Math.ceil(
114
113
  (size * 2 - memory.buffer.byteLength + 8) / (64 * 1024)
@@ -136,10 +135,10 @@ const codecs = {
136
135
  name: "MozJPEG",
137
136
  extension: "jpg",
138
137
  detectors: [/^\xFF\xD8\xFF/],
139
- dec: () => instantiateEmscriptenWasm(mozDec, mozDecWasm.toString()),
138
+ dec: () => instantiateEmscriptenWasm(mozDec, mozDecWasm),
140
139
  enc: () => instantiateEmscriptenWasm(
141
140
  mozEnc,
142
- mozEncWasm.toString()
141
+ mozEncWasm
143
142
  ),
144
143
  defaultEncoderOptions: {
145
144
  quality: 75,
@@ -169,10 +168,10 @@ const codecs = {
169
168
  name: "WebP",
170
169
  extension: "webp",
171
170
  detectors: [/^RIFF....WEBPVP8[LX ]/s],
172
- dec: () => instantiateEmscriptenWasm(webpDec, webpDecWasm.toString()),
171
+ dec: () => instantiateEmscriptenWasm(webpDec, webpDecWasm),
173
172
  enc: () => instantiateEmscriptenWasm(
174
173
  webpEnc,
175
- webpEncWasm.toString()
174
+ webpEncWasm
176
175
  ),
177
176
  defaultEncoderOptions: {
178
177
  quality: 75,
@@ -214,11 +213,11 @@ const codecs = {
214
213
  extension: "avif",
215
214
  // eslint-disable-next-line no-control-regex
216
215
  detectors: [/^\x00\x00\x00 ftypavif\x00\x00\x00\x00/],
217
- dec: () => instantiateEmscriptenWasm(avifDec, avifDecWasm.toString()),
216
+ dec: () => instantiateEmscriptenWasm(avifDec, avifDecWasm),
218
217
  enc: async () => {
219
218
  return instantiateEmscriptenWasm(
220
219
  avifEnc,
221
- avifEncWasm.toString()
220
+ avifEncWasm
222
221
  );
223
222
  },
224
223
  defaultEncoderOptions: {
@@ -1,9 +1,9 @@
1
1
  export declare function pathify(path: string): string;
2
- export declare function instantiateEmscriptenWasm<T extends EmscriptenWasm.Module>(factory: EmscriptenWasm.ModuleFactory<T>, path: string, workerJS?: string): Promise<T>;
2
+ export declare function instantiateEmscriptenWasm<T extends EmscriptenWasm.Module>(factory: EmscriptenWasm.ModuleFactory<T>, bytes: Uint8Array): Promise<T>;
3
3
  export declare function dirname(url: string): string;
4
4
  /**
5
5
  * On certain serverless hosts, our ESM bundle is transpiled to CJS before being run, which means
6
- * import.meta.url is undefined, so we'll fall back to __dirname in those cases
6
+ * import.meta.url is undefined, so we'll fall back to __filename in those cases
7
7
  * We should be able to remove this once https://github.com/netlify/zip-it-and-ship-it/issues/750 is fixed
8
8
  */
9
9
  export declare function getModuleURL(url: string | undefined): string;
@@ -5,14 +5,12 @@ function pathify(path) {
5
5
  }
6
6
  return path;
7
7
  }
8
- function instantiateEmscriptenWasm(factory, path, workerJS = "") {
8
+ function instantiateEmscriptenWasm(factory, bytes) {
9
9
  return factory({
10
- locateFile(requestPath) {
11
- if (requestPath.endsWith(".wasm"))
12
- return pathify(path);
13
- if (requestPath.endsWith(".worker.js"))
14
- return pathify(workerJS);
15
- return requestPath;
10
+ // @ts-expect-error This is a valid Emscripten option, but the type definitions don't know about it
11
+ wasmBinary: bytes,
12
+ locateFile(file) {
13
+ return file;
16
14
  }
17
15
  });
18
16
  }
@@ -21,7 +19,7 @@ function dirname(url) {
21
19
  }
22
20
  function getModuleURL(url) {
23
21
  if (!url) {
24
- return pathToFileURL(__dirname).toString();
22
+ return pathToFileURL(__filename).toString();
25
23
  }
26
24
  return url;
27
25
  }
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ declare const _default: Buffer;
3
+ export default _default;