prompt-api-polyfill 1.19.0 → 1.20.0

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.
@@ -272,6 +272,7 @@ var i = class i extends EventTarget {
272
272
  return n(i.#d(e).path);
273
273
  }
274
274
  static async #p(e = {}, t = globalThis) {
275
+ if (e.samplingMode !== void 0 && typeof e.samplingMode != "string") throw TypeError("The samplingMode option must be a string.");
275
276
  if (e.expectedInputs) for (let t of e.expectedInputs) {
276
277
  if (t.type !== "text" && t.type !== "image" && t.type !== "audio") throw TypeError(`Invalid input type: ${t.type}`);
277
278
  t.languages && i.#m(t.languages);
@@ -312,7 +313,7 @@ var i = class i extends EventTarget {
312
313
  }
313
314
  static async create(e = {}) {
314
315
  let t = this.__window || globalThis;
315
- if (i.#c(t), await i.#p(e, t), e.signal?.aborted) throw e.signal.reason || new (t.DOMException || globalThis.DOMException)("Aborted", "AbortError");
316
+ if (i.#c(t), await i.#p(e, t), e.samplingMode !== void 0 && console.warn(`Prompt API Polyfill: The samplingMode option ("${e.samplingMode}") is not supported and will be silently ignored.`), e.signal?.aborted) throw e.signal.reason || new (t.DOMException || globalThis.DOMException)("Aborted", "AbortError");
316
317
  let n = await this.availability(e);
317
318
  if (n === "unavailable") throw new (t.DOMException || globalThis.DOMException)("The model is not available for the given options.", "NotSupportedError");
318
319
  if (n === "downloadable" || n === "downloading") throw new (t.DOMException || globalThis.DOMException)("Requires a user gesture when availability is \"downloading\" or \"downloadable\".", "NotAllowedError");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prompt-api-polyfill",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Polyfill for the Prompt API (`LanguageModel`) backed by Firebase AI Logic, Gemini API, OpenAI API, or Transformers.js.",
5
5
  "type": "module",
6
6
  "main": "./dist/prompt-api-polyfill.js",
@@ -47,20 +47,20 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@eslint/js": "^10.0.1",
50
- "eslint": "^10.4.0",
50
+ "eslint": "^10.4.1",
51
51
  "eslint-config-prettier": "^10.1.8",
52
52
  "globals": "^17.6.0",
53
53
  "node-addon-api": "^8.8.0",
54
- "node-gyp": "^12.3.0",
55
- "prettier": "^3.8.3",
54
+ "node-gyp": "^12.4.0",
55
+ "prettier": "^3.8.4",
56
56
  "prettier-plugin-curly": "^0.4.1",
57
- "vite": "^8.0.14"
57
+ "vite": "^8.0.16"
58
58
  },
59
59
  "dependencies": {
60
- "@google/genai": "^2.6.0",
60
+ "@google/genai": "^2.8.0",
61
61
  "@huggingface/transformers": "^4.2.0",
62
- "@mlc-ai/web-llm": "^0.2.83",
63
- "firebase": "^12.13.0",
64
- "openai": "^6.39.0"
62
+ "@mlc-ai/web-llm": "^0.2.84",
63
+ "firebase": "^12.14.0",
64
+ "openai": "^6.42.0"
65
65
  }
66
66
  }