@celljs/ta-extensions 4.15.1 → 4.16.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/package.json +4 -4
  2. package/web/index.js +40 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-extensions",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "description": "A pi package for Ta: the page of extensions, where the user makes one by saying what it should do, and hands extensions on or takes them in as one file",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-harness": "4.15.1",
31
- "@celljs/ta-protocol": "4.15.1",
32
- "@celljs/ta-web": "4.15.1",
30
+ "@celljs/ta-harness": "4.16.0",
31
+ "@celljs/ta-protocol": "4.16.0",
32
+ "@celljs/ta-web": "4.16.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {
package/web/index.js CHANGED
@@ -873,15 +873,47 @@ var TaGatewayServer = Symbol("TaGatewayServer");
873
873
  var TaLocation;
874
874
  (function(TaLocation2) {
875
875
  TaLocation2.SSH = "ssh://";
876
+ TaLocation2.CLOUD = "ta://";
877
+ const CLOUD_NAME = /^[a-z0-9][a-z0-9-]{0,39}$/;
876
878
  const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
877
879
  function isRemote(location) {
878
- return location.startsWith(TaLocation2.SSH);
880
+ return location.startsWith(TaLocation2.SSH) || location.startsWith(TaLocation2.CLOUD);
879
881
  }
880
882
  TaLocation2.isRemote = isRemote;
883
+ function isCloud(host2) {
884
+ return !!host2 && host2.startsWith(TaLocation2.CLOUD);
885
+ }
886
+ TaLocation2.isCloud = isCloud;
887
+ function isCloudName(name) {
888
+ return CLOUD_NAME.test(name);
889
+ }
890
+ TaLocation2.isCloudName = isCloudName;
891
+ function cloud(name, path2 = "") {
892
+ return `${TaLocation2.CLOUD}${name}${path2 ? normalize(path2) : ""}`;
893
+ }
894
+ TaLocation2.cloud = cloud;
895
+ function cloudName(hostOrLocation) {
896
+ if (!hostOrLocation.startsWith(TaLocation2.CLOUD)) {
897
+ return;
898
+ }
899
+ const rest = hostOrLocation.slice(TaLocation2.CLOUD.length);
900
+ const slash = rest.indexOf("/");
901
+ return slash < 0 ? rest : rest.slice(0, slash);
902
+ }
903
+ TaLocation2.cloudName = cloudName;
881
904
  function parse(location) {
905
+ var _a;
882
906
  if (!isRemote(location)) {
883
907
  return;
884
908
  }
909
+ if (location.startsWith(TaLocation2.CLOUD)) {
910
+ const name = (_a = cloudName(location)) !== null && _a !== undefined ? _a : "";
911
+ if (!isCloudName(name)) {
912
+ throw new Error(`${JSON.stringify(location)} names no cloud workspace: write ta://<name>/<path>.`);
913
+ }
914
+ const path3 = location.slice(TaLocation2.CLOUD.length + name.length);
915
+ return { host: `${TaLocation2.CLOUD}${name}`, path: path3 ? normalize(path3) : "" };
916
+ }
885
917
  const rest = location.slice(TaLocation2.SSH.length);
886
918
  const slash = rest.indexOf("/");
887
919
  const host2 = slash < 0 ? rest : rest.slice(0, slash);
@@ -893,7 +925,7 @@ var TaLocation;
893
925
  }
894
926
  TaLocation2.parse = parse;
895
927
  function isHost(host2) {
896
- return HOST.test(host2);
928
+ return isCloud(host2) ? isCloudName(host2.slice(TaLocation2.CLOUD.length)) : HOST.test(host2);
897
929
  }
898
930
  TaLocation2.isHost = isHost;
899
931
  const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
@@ -957,10 +989,13 @@ var TaLocation;
957
989
  }
958
990
  TaLocation2.readHost = readHost;
959
991
  function ssh(host2, path2 = "") {
960
- return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
992
+ return isCloud(host2) ? `${host2}${path2 ? normalize(path2) : ""}` : `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
961
993
  }
962
994
  TaLocation2.ssh = ssh;
963
995
  function hostLabel(host2) {
996
+ if (isCloud(host2)) {
997
+ return host2.slice(TaLocation2.CLOUD.length);
998
+ }
964
999
  const name = host2.replace(/^[^@]*@/, "").replace(/^\[(.*)\](?::\d+)?$/, "$1").replace(/^([^:]*):\d+$/, "$1");
965
1000
  return /^[\d.]+$/.test(name) || name.includes(":") ? name : name.split(".")[0] || name;
966
1001
  }
@@ -1492,6 +1527,8 @@ var TaActionUtil;
1492
1527
  }
1493
1528
  TaActionUtil2.inside = inside;
1494
1529
  })(TaActionUtil || (TaActionUtil = {}));
1530
+ // ../ta-protocol/esm/common/usage-protocol.js
1531
+ var TaUsageServer = Symbol("TaUsageServer");
1495
1532
  // ../ta-protocol/esm/common/workspace-protocol.js
1496
1533
  var TaWorkspaceServer = Symbol("TaWorkspaceServer");
1497
1534
  var TaTerminalServer = Symbol("TaTerminalServer");