@jsenv/plugin-supervisor 1.6.7 → 1.6.9

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.
@@ -3,12 +3,9 @@ import process$1 from "node:process";
3
3
  import os from "node:os";
4
4
  import tty from "node:tty";
5
5
  import "string-width";
6
- import { pathToFileURL, fileURLToPath } from "node:url";
7
- import "./js/vendors.js";
8
6
  import { createRequire } from "node:module";
9
7
  import { existsSync, readFileSync, realpathSync } from "node:fs";
10
- import "node:path";
11
- import "node:crypto";
8
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
9
 
13
10
  // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
14
11
  /// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
@@ -498,30 +495,6 @@ const injectQueryParams = (url, params) => {
498
495
  return normalizeUrl(urlWithParams);
499
496
  };
500
497
 
501
- const isFileSystemPath = value => {
502
- if (typeof value !== "string") {
503
- throw new TypeError("isFileSystemPath first arg must be a string, got ".concat(value));
504
- }
505
- if (value[0] === "/") {
506
- return true;
507
- }
508
- return startsWithWindowsDriveLetter(value);
509
- };
510
- const startsWithWindowsDriveLetter = string => {
511
- const firstChar = string[0];
512
- if (!/[a-zA-Z]/.test(firstChar)) return false;
513
- const secondChar = string[1];
514
- if (secondChar !== ":") return false;
515
- return true;
516
- };
517
-
518
- const fileSystemPathToUrl = value => {
519
- if (!isFileSystemPath(value)) {
520
- throw new Error("value must be a filesystem path, got ".concat(value));
521
- }
522
- return String(pathToFileURL(value));
523
- };
524
-
525
498
  const getCommonPathname = (pathname, otherPathname) => {
526
499
  if (pathname === otherPathname) {
527
500
  return pathname;
@@ -614,12 +587,6 @@ const requireSourcemap = () => {
614
587
  return namespace;
615
588
  };
616
589
 
617
- /*
618
- * https://github.com/mozilla/source-map#sourcemapgenerator
619
- */
620
-
621
- requireSourcemap();
622
-
623
590
  // https://github.com/mozilla/source-map#sourcemapconsumerprototypeoriginalpositionforgeneratedposition
624
591
  const getOriginalPosition = ({
625
592
  sourcemap,
@@ -1521,6 +1488,7 @@ const applyBrowserFieldResolution = (specifier, resolutionContext) => {
1521
1488
  if (url) {
1522
1489
  return {
1523
1490
  type: "field:browser",
1491
+ isMain: true,
1524
1492
  packageDirectoryUrl,
1525
1493
  packageJson,
1526
1494
  url
@@ -1750,6 +1718,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
1750
1718
  }
1751
1719
  return {
1752
1720
  type: isImport ? "field:imports" : "field:exports",
1721
+ isMain: subpath === "" || subpath === ".",
1753
1722
  packageDirectoryUrl,
1754
1723
  packageJson,
1755
1724
  url: pattern ? targetUrl.replaceAll("*", subpath) : new URL(subpath, targetUrl).href
@@ -1932,6 +1901,7 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
1932
1901
  }
1933
1902
  return {
1934
1903
  type: "subpath",
1904
+ isMain: packageSubpath === ".",
1935
1905
  packageDirectoryUrl,
1936
1906
  packageJson,
1937
1907
  url: new URL(packageSubpath, packageDirectoryUrl).href
@@ -1952,6 +1922,7 @@ const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
1952
1922
  if (resolved) {
1953
1923
  return {
1954
1924
  type: resolved.type,
1925
+ isMain: resolved.isMain,
1955
1926
  packageDirectoryUrl,
1956
1927
  packageJson,
1957
1928
  url: new URL(resolved.path, packageDirectoryUrl).href
@@ -1961,6 +1932,7 @@ const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
1961
1932
  return {
1962
1933
  type: "field:main",
1963
1934
  // the absence of "main" field
1935
+ isMain: true,
1964
1936
  packageDirectoryUrl,
1965
1937
  packageJson,
1966
1938
  url: new URL("index.js", packageDirectoryUrl).href
@@ -1973,18 +1945,21 @@ const mainLegacyResolvers = {
1973
1945
  if (typeof packageJson.module === "string") {
1974
1946
  return {
1975
1947
  type: "field:module",
1948
+ isMain: true,
1976
1949
  path: packageJson.module
1977
1950
  };
1978
1951
  }
1979
1952
  if (typeof packageJson.jsnext === "string") {
1980
1953
  return {
1981
1954
  type: "field:jsnext",
1955
+ isMain: true,
1982
1956
  path: packageJson.jsnext
1983
1957
  };
1984
1958
  }
1985
1959
  if (typeof packageJson.main === "string") {
1986
1960
  return {
1987
1961
  type: "field:main",
1962
+ isMain: true,
1988
1963
  path: packageJson.main
1989
1964
  };
1990
1965
  }
@@ -2007,6 +1982,7 @@ const mainLegacyResolvers = {
2007
1982
  if (typeof packageJson.module === "string") {
2008
1983
  return {
2009
1984
  type: "field:module",
1985
+ isMain: true,
2010
1986
  path: packageJson.module
2011
1987
  };
2012
1988
  }
@@ -2015,6 +1991,7 @@ const mainLegacyResolvers = {
2015
1991
  if (typeof packageJson.module !== "string" || packageJson.module === browserMain) {
2016
1992
  return {
2017
1993
  type: "field:browser",
1994
+ isMain: true,
2018
1995
  path: browserMain
2019
1996
  };
2020
1997
  }
@@ -2023,11 +2000,13 @@ const mainLegacyResolvers = {
2023
2000
  if (/typeof exports\s*==/.test(content) && /typeof module\s*==/.test(content) || /module\.exports\s*=/.test(content)) {
2024
2001
  return {
2025
2002
  type: "field:module",
2003
+ isMain: true,
2026
2004
  path: packageJson.module
2027
2005
  };
2028
2006
  }
2029
2007
  return {
2030
2008
  type: "field:browser",
2009
+ isMain: true,
2031
2010
  path: browserMain
2032
2011
  };
2033
2012
  },
@@ -2037,6 +2016,7 @@ const mainLegacyResolvers = {
2037
2016
  if (typeof packageJson.main === "string") {
2038
2017
  return {
2039
2018
  type: "field:main",
2019
+ isMain: true,
2040
2020
  path: packageJson.main
2041
2021
  };
2042
2022
  }
@@ -2080,35 +2060,6 @@ const resolvePackageSymlink = packageDirectoryUrl => {
2080
2060
  return "".concat(packageDirectoryResolvedUrl, "/");
2081
2061
  };
2082
2062
 
2083
- process.platform === "win32";
2084
- fileSystemPathToUrl(process.cwd());
2085
-
2086
- /*
2087
- * - stats object documentation on Node.js
2088
- * https://nodejs.org/docs/latest-v13.x/api/fs.html#fs_class_fs_stats
2089
- */
2090
-
2091
- process.platform === "win32";
2092
-
2093
- /*
2094
- * - stats object documentation on Node.js
2095
- * https://nodejs.org/docs/latest-v13.x/api/fs.html#fs_class_fs_stats
2096
- */
2097
-
2098
- process.platform === "win32";
2099
-
2100
- process.platform === "win32";
2101
-
2102
- process.platform === "win32";
2103
-
2104
- process.platform === "win32";
2105
-
2106
- process.platform === "linux";
2107
-
2108
- process.platform === "darwin";
2109
- process.platform === "linux";
2110
- process.platform === "freebsd";
2111
-
2112
2063
  /*
2113
2064
  * This plugin provides a way for jsenv to supervisor js execution:
2114
2065
  * - Know how many js are executed, when they are done, collect errors, etc...
@@ -2199,7 +2150,6 @@ const jsenvPluginSupervisor = ({
2199
2150
  if (sourcemap) {
2200
2151
  const original = getOriginalPosition({
2201
2152
  sourcemap,
2202
- url: file,
2203
2153
  line,
2204
2154
  column
2205
2155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-supervisor",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,10 +25,13 @@
25
25
  "/src/",
26
26
  "/dist/"
27
27
  ],
28
+ "sideEffects": [
29
+ "./src/client/supervisor.js"
30
+ ],
28
31
  "dependencies": {
29
- "@jsenv/ast": "6.6.0",
30
- "@jsenv/urls": "2.6.1",
31
- "@jsenv/sourcemap": "1.3.0"
32
+ "@jsenv/ast": "6.6.2",
33
+ "@jsenv/urls": "2.6.3",
34
+ "@jsenv/sourcemap": "1.3.2"
32
35
  },
33
36
  "scripts": {
34
37
  "build": "node ./scripts/build.mjs",
@@ -1,8 +0,0 @@
1
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
2
- const intToChar = new Uint8Array(64); // 64 possible chars.
3
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
4
- for (let i = 0; i < chars.length; i++) {
5
- const c = chars.charCodeAt(i);
6
- intToChar[i] = c;
7
- charToInt[c] = i;
8
- }