@linguacode/cli 2.2.0 → 2.4.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.
Files changed (2) hide show
  1. package/bin/lingua.cjs +64 -11
  2. package/package.json +2 -2
package/bin/lingua.cjs CHANGED
@@ -344,7 +344,7 @@ function parseRunCapsule(json) {
344
344
  }
345
345
  const environment = candidate.environment;
346
346
  const git = environment.git;
347
- if (environment.platform !== "web" && environment.platform !== "desktop" || typeof environment.runner !== "string" || git !== void 0 && (!isRecord(git) || git.branch !== void 0 && typeof git.branch !== "string" || git.commit !== void 0 && typeof git.commit !== "string")) {
347
+ if (environment.platform !== "web" && environment.platform !== "desktop" || typeof environment.runner !== "string" || environment.runtime !== void 0 && typeof environment.runtime !== "string" || git !== void 0 && (!isRecord(git) || git.branch !== void 0 && typeof git.branch !== "string" || git.commit !== void 0 && typeof git.commit !== "string")) {
348
348
  return {
349
349
  ok: false,
350
350
  reason: "invalid-field-type",
@@ -6726,6 +6726,55 @@ async function readBoundedSuite(file, limit) {
6726
6726
  // src/cli/commands/capsuleVerify.ts
6727
6727
  var import_promises4 = require("node:fs/promises");
6728
6728
 
6729
+ // src/shared/languageFamilies.ts
6730
+ var JS_FAMILY_LANGUAGES = /* @__PURE__ */ new Set([
6731
+ "javascript",
6732
+ "typescript"
6733
+ ]);
6734
+ function isJavaScriptFamily(language) {
6735
+ return typeof language === "string" && JS_FAMILY_LANGUAGES.has(language);
6736
+ }
6737
+
6738
+ // src/shared/runtimeModes.ts
6739
+ var RUNTIME_MODES = ["worker", "node", "browser-preview", "deno", "bun"];
6740
+ var RUNTIME_MODE_SET = new Set(RUNTIME_MODES);
6741
+ function isRuntimeMode(value) {
6742
+ return typeof value === "string" && RUNTIME_MODE_SET.has(value);
6743
+ }
6744
+
6745
+ // src/shared/capsuleRuntime.ts
6746
+ var CAPSULE_RUNTIMES = [
6747
+ "web-worker",
6748
+ "node",
6749
+ "deno",
6750
+ "bun",
6751
+ "browser-preview",
6752
+ "pyodide",
6753
+ "ruby-wasm",
6754
+ // Go compiled by the local toolchain, run as WebAssembly in a worker.
6755
+ "go-wasm",
6756
+ // A local binary: Rust, system Ruby, and the Python, Go and Rust debuggers.
6757
+ "local-process"
6758
+ ];
6759
+ function capsuleRuntimeForMode(mode) {
6760
+ return mode === "worker" ? "web-worker" : mode;
6761
+ }
6762
+ function isCapsuleRuntime(value) {
6763
+ return typeof value === "string" && CAPSULE_RUNTIMES.includes(value);
6764
+ }
6765
+ function capsuleRuntimeOf(capsule) {
6766
+ const recorded = capsule.environment.runtime;
6767
+ if (isCapsuleRuntime(recorded)) return recorded;
6768
+ const { language, runtimeMode } = capsule.tab;
6769
+ if (isJavaScriptFamily(language)) {
6770
+ return isRuntimeMode(runtimeMode) ? capsuleRuntimeForMode(runtimeMode) : null;
6771
+ }
6772
+ if (capsule.environment.platform !== "web") return null;
6773
+ if (language === "python") return "pyodide";
6774
+ if (language === "ruby") return "ruby-wasm";
6775
+ return null;
6776
+ }
6777
+
6729
6778
  // src/shared/runnerLimits.ts
6730
6779
  var MAX_NATIVE_STDERR_BYTES = 1024 * 1024;
6731
6780
  var MAX_STDIN_WRITE_BYTES = 256 * 1024;
@@ -6747,9 +6796,13 @@ function capsuleVerificationBlocker(capsule, maxStreamBytes = MAX_STREAM_BYTES)
6747
6796
  return "incomplete-baseline";
6748
6797
  return null;
6749
6798
  }
6799
+ var WASM_ENGINES = /* @__PURE__ */ new Set(["pyodide", "ruby-wasm", "go-wasm"]);
6750
6800
  function capsuleEngineDivergence(capsule) {
6801
+ const runtime = capsuleRuntimeOf(capsule);
6802
+ const recorded = capsule.environment.runtime;
6751
6803
  const { language } = capsule.tab;
6752
- const divergent = language === "python" || language === "go" || language === "ruby" && capsule.environment.platform === "web";
6804
+ const unknown = recorded !== void 0 && recorded !== runtime;
6805
+ const divergent = unknown || (runtime ? WASM_ENGINES.has(runtime) : language === "python" || language === "go");
6753
6806
  return divergent ? "engine-divergent-baseline" : null;
6754
6807
  }
6755
6808
  function compareCapsuleStreams(capsule, actual) {
@@ -7830,9 +7883,9 @@ var UTILITY_ADAPTER_IDS = [
7830
7883
  "string-case",
7831
7884
  "html-entity-encode",
7832
7885
  "html-entity-decode",
7833
- // Vocabulary expansion round 2. Pure text→text
7834
- // transforms (number radix, line sort, slugify, JSON minify, text
7835
- // stats). Each is a self-contained shared reimplementation.
7886
+ // Vocabulary expansion round 2. Pure text transforms (number
7887
+ // radix, line sort, slugify, JSON minify, text stats). Each is a
7888
+ // self-contained shared reimplementation.
7836
7889
  "number-base",
7837
7890
  "line-sort",
7838
7891
  "slugify",
@@ -10197,7 +10250,7 @@ var jsonFormatAdapter = {
10197
10250
  titleKey: "utilityPipeline.adapter.jsonFormat.title",
10198
10251
  descriptionKey: "utilityPipeline.adapter.jsonFormat.description",
10199
10252
  inputKind: "text",
10200
- outputKind: "text",
10253
+ outputKind: "json",
10201
10254
  optionsSchema: [
10202
10255
  {
10203
10256
  key: "indent",
@@ -10260,7 +10313,7 @@ var jsonMinifyAdapter = {
10260
10313
  titleKey: "utilityPipeline.adapter.jsonMinify.title",
10261
10314
  descriptionKey: "utilityPipeline.adapter.jsonMinify.description",
10262
10315
  inputKind: "text",
10263
- outputKind: "text",
10316
+ outputKind: "json",
10264
10317
  optionsSchema: [],
10265
10318
  defaultOptions: () => ({}),
10266
10319
  parseOptions: parseEmptyOptions4,
@@ -10302,7 +10355,7 @@ var jwtDecodeAdapter = {
10302
10355
  titleKey: "utilityPipeline.adapter.jwtDecode.title",
10303
10356
  descriptionKey: "utilityPipeline.adapter.jwtDecode.description",
10304
10357
  inputKind: "text",
10305
- outputKind: "text",
10358
+ outputKind: "json",
10306
10359
  optionsSchema: [],
10307
10360
  defaultOptions: () => ({}),
10308
10361
  parseOptions: parseEmptyOptions5,
@@ -12053,7 +12106,7 @@ var urlParseAdapter = {
12053
12106
  titleKey: "utilityPipeline.adapter.urlParse.title",
12054
12107
  descriptionKey: "utilityPipeline.adapter.urlParse.description",
12055
12108
  inputKind: "text",
12056
- outputKind: "text",
12109
+ outputKind: "json",
12057
12110
  optionsSchema: [],
12058
12111
  defaultOptions: () => ({}),
12059
12112
  parseOptions: (raw) => {
@@ -13339,8 +13392,8 @@ function assertSingleTarget(command, positionals, help, label2) {
13339
13392
 
13340
13393
  // src/cli/lingua.ts
13341
13394
  function resolveCliVersion() {
13342
- if ("2.2.0".length > 0) {
13343
- return "2.2.0";
13395
+ if ("2.4.0".length > 0) {
13396
+ return "2.4.0";
13344
13397
  }
13345
13398
  return "0.0.0-dev";
13346
13399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linguacode/cli",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Headless offline CLI for Lingua utilities, local runners, and Run Capsules",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://linguacode.dev",
@@ -27,7 +27,7 @@
27
27
  "LICENSE"
28
28
  ],
29
29
  "engines": {
30
- "node": ">=26.13.0"
30
+ "node": ">=26.13.1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"