@jsenv/core 29.8.2 → 29.8.4

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.
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  Jsenv was created to provide a tool that can be used both for the web and Node.js.
4
4
  It has naturally evolved to cover the core needs of a JavaScript project: developement, testing and building for production.
5
5
 
6
- - :exploding_head: Execute HTML files as tests
7
- - :sparkles: Dev, tests and build in a single tool
8
6
  - :ok_hand: Seamless integration with standard HTML, CSS and JS
7
+ - :sparkles: Same tooling for dev tests and build
8
+ - :exploding_head: Can execute tests on Chrome, Firefox, Safari and Node.js
9
9
 
10
10
  # Documentation
11
11
 
package/dist/main.js CHANGED
@@ -11596,14 +11596,12 @@ const jsenvPluginReferenceExpectedTypes = () => {
11596
11596
  reference.isEntryPoint = true;
11597
11597
  }
11598
11598
  if (searchParams.has("js_classic")) {
11599
- searchParams.delete("js_classic");
11600
11599
  reference.expectedType = "js_classic";
11601
11600
  } else if (searchParams.has("as_js_classic") || searchParams.has("as_js_classic_library")) {
11602
11601
  reference.expectedType = "js_classic";
11603
11602
  } else if (searchParams.has("as_js_module")) {
11604
11603
  reference.expectedType = "js_module";
11605
11604
  } else if (searchParams.has("js_module")) {
11606
- searchParams.delete("js_module");
11607
11605
  reference.expectedType = "js_module";
11608
11606
  } else if (reference.type === "js_url" && reference.expectedType === undefined && CONTENT_TYPE.fromUrlExtension(reference.url) === "text/javascript") {
11609
11607
  // by default, js referenced by new URL is considered as "js_module"
@@ -11613,13 +11611,10 @@ const jsenvPluginReferenceExpectedTypes = () => {
11613
11611
  }
11614
11612
  if (searchParams.has("worker")) {
11615
11613
  reference.expectedSubtype = "worker";
11616
- searchParams.delete("worker");
11617
11614
  } else if (searchParams.has("service_worker")) {
11618
11615
  reference.expectedSubtype = "service_worker";
11619
- searchParams.delete("service_worker");
11620
11616
  } else if (searchParams.has("shared_worker")) {
11621
11617
  reference.expectedSubtype = "shared_worker";
11622
- searchParams.delete("shared_worker");
11623
11618
  }
11624
11619
  return urlObject.href;
11625
11620
  };
@@ -11628,7 +11623,8 @@ const jsenvPluginReferenceExpectedTypes = () => {
11628
11623
  appliesDuring: "*",
11629
11624
  redirectUrl: {
11630
11625
  script_src: redirectJsUrls,
11631
- js_url: redirectJsUrls
11626
+ js_url: redirectJsUrls,
11627
+ js_import: redirectJsUrls
11632
11628
  }
11633
11629
  };
11634
11630
  };
@@ -20288,24 +20284,22 @@ const jsenvPluginImportAssertions = ({
20288
20284
  transpilations.text = true;
20289
20285
  }
20290
20286
  },
20291
- redirectUrl: {
20292
- js_import: (reference, context) => {
20293
- if (!reference.assert) {
20294
- return null;
20295
- }
20296
- const {
20297
- searchParams
20298
- } = reference;
20299
- if (searchParams.has("as_json_module") || searchParams.has("as_css_module") || searchParams.has("as_text_module")) {
20300
- markAsJsModuleProxy(reference);
20301
- return null;
20302
- }
20303
- const type = reference.assert.type;
20304
- if (shouldTranspileImportAssertion(context, type)) {
20305
- return turnIntoJsModuleProxy(reference, type);
20306
- }
20287
+ redirectUrl: (reference, context) => {
20288
+ if (!reference.assert) {
20307
20289
  return null;
20308
20290
  }
20291
+ const {
20292
+ searchParams
20293
+ } = reference;
20294
+ if (searchParams.has("as_json_module") || searchParams.has("as_css_module") || searchParams.has("as_text_module")) {
20295
+ markAsJsModuleProxy(reference);
20296
+ return null;
20297
+ }
20298
+ const type = reference.assert.type;
20299
+ if (shouldTranspileImportAssertion(context, type)) {
20300
+ return turnIntoJsModuleProxy(reference, type);
20301
+ }
20302
+ return null;
20309
20303
  }
20310
20304
  };
20311
20305
  return [importAssertions, ...jsenvPluginAsModules()];
@@ -23542,6 +23536,8 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23542
23536
  throw new Error(`urls should be inside build directory at this stage, found "${reference.url}"`);
23543
23537
  }
23544
23538
  const generatedUrlObject = new URL(reference.generatedUrl);
23539
+ generatedUrlObject.searchParams.delete("js_classic");
23540
+ generatedUrlObject.searchParams.delete("js_module");
23545
23541
  generatedUrlObject.searchParams.delete("as_js_classic");
23546
23542
  generatedUrlObject.searchParams.delete("as_js_classic_library");
23547
23543
  generatedUrlObject.searchParams.delete("as_js_module");
@@ -23752,7 +23748,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23752
23748
  const dependentUrlInfo = rawGraph.getUrlInfo(dependent);
23753
23749
  for (const reference of dependentUrlInfo.references) {
23754
23750
  if (reference.url === referencedUrlInfo.url) {
23755
- willAlreadyBeBundled = reference.type === "js_import" && reference.subtype === "import_dynamic" || reference.type === "script_src";
23751
+ willAlreadyBeBundled = reference.subtype === "import_dynamic" || reference.type === "script_src";
23756
23752
  }
23757
23753
  }
23758
23754
  }
@@ -27584,7 +27580,7 @@ const registerEvent = ({
27584
27580
 
27585
27581
  const chromium = createRuntimeFromPlaywright({
27586
27582
  browserName: "chromium",
27587
- browserVersion: "105.0.5195.19",
27583
+ browserVersion: "108.0.5359.29",
27588
27584
  // to update, check https://github.com/microsoft/playwright/releases
27589
27585
  coveragePlaywrightAPIAvailable: true
27590
27586
  });
@@ -27592,14 +27588,14 @@ const chromiumIsolatedTab = chromium.isolatedTab;
27592
27588
 
27593
27589
  const firefox = createRuntimeFromPlaywright({
27594
27590
  browserName: "firefox",
27595
- browserVersion: "103.0" // to update, check https://github.com/microsoft/playwright/releases
27591
+ browserVersion: "106.0" // to update, check https://github.com/microsoft/playwright/releases
27596
27592
  });
27597
27593
 
27598
27594
  const firefoxIsolatedTab = firefox.isolatedTab;
27599
27595
 
27600
27596
  const webkit = createRuntimeFromPlaywright({
27601
27597
  browserName: "webkit",
27602
- browserVersion: "16.0",
27598
+ browserVersion: "16.4",
27603
27599
  // to update, check https://github.com/microsoft/playwright/releases
27604
27600
  ignoreErrorHook: error => {
27605
27601
  // we catch error during execution but safari throw unhandled rejection
@@ -28461,6 +28457,14 @@ const onceWorkerThreadEvent = (worker, type, callback) => {
28461
28457
  * "startBuildServer" must be as close as possible from a static file server because
28462
28458
  * we want to be in the user shoes and we should not alter build files.
28463
28459
  */
28460
+
28461
+ /**
28462
+ * Start a server for build files.
28463
+ * @param {Object} buildServerParameters
28464
+ * @param {string|url} buildServerParameters.rootDirectoryUrl Root directory of the project
28465
+ * @param {string|url} buildServerParameters.buildDirectoryUrl Directory where build files are written
28466
+ * @return {Object} A build server object
28467
+ */
28464
28468
  const startBuildServer = async ({
28465
28469
  signal = new AbortController().signal,
28466
28470
  handleSIGINT = true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "29.8.2",
3
+ "version": "29.8.4",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -106,11 +106,11 @@
106
106
  "@jsenv/https-local": "3.0.1",
107
107
  "@jsenv/package-workspace": "0.5.0",
108
108
  "@jsenv/performance-impact": "3.0.1",
109
- "eslint": "8.27.0",
109
+ "eslint": "8.28.0",
110
110
  "eslint-plugin-html": "7.1.0",
111
111
  "eslint-plugin-import": "2.26.0",
112
- "eslint-plugin-react": "7.31.10",
113
- "playwright": "1.27.1",
112
+ "eslint-plugin-react": "7.31.11",
113
+ "playwright": "1.28.0",
114
114
  "prettier": "2.7.1"
115
115
  }
116
116
  }
@@ -495,6 +495,8 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
495
495
  )
496
496
  }
497
497
  const generatedUrlObject = new URL(reference.generatedUrl)
498
+ generatedUrlObject.searchParams.delete("js_classic")
499
+ generatedUrlObject.searchParams.delete("js_module")
498
500
  generatedUrlObject.searchParams.delete("as_js_classic")
499
501
  generatedUrlObject.searchParams.delete("as_js_classic_library")
500
502
  generatedUrlObject.searchParams.delete("as_js_module")
@@ -725,8 +727,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
725
727
  for (const reference of dependentUrlInfo.references) {
726
728
  if (reference.url === referencedUrlInfo.url) {
727
729
  willAlreadyBeBundled =
728
- (reference.type === "js_import" &&
729
- reference.subtype === "import_dynamic") ||
730
+ reference.subtype === "import_dynamic" ||
730
731
  reference.type === "script_src"
731
732
  }
732
733
  }
@@ -32,6 +32,13 @@ import { getCallerPosition } from "@jsenv/urls"
32
32
 
33
33
  import { createReloadableWorker } from "@jsenv/core/src/helpers/worker_reload.js"
34
34
 
35
+ /**
36
+ * Start a server for build files.
37
+ * @param {Object} buildServerParameters
38
+ * @param {string|url} buildServerParameters.rootDirectoryUrl Root directory of the project
39
+ * @param {string|url} buildServerParameters.buildDirectoryUrl Directory where build files are written
40
+ * @return {Object} A build server object
41
+ */
35
42
  export const startBuildServer = async ({
36
43
  signal = new AbortController().signal,
37
44
  handleSIGINT = true,
@@ -2,7 +2,7 @@ import { createRuntimeFromPlaywright } from "./from_playwright.js"
2
2
 
3
3
  export const chromium = createRuntimeFromPlaywright({
4
4
  browserName: "chromium",
5
- browserVersion: "105.0.5195.19", // to update, check https://github.com/microsoft/playwright/releases
5
+ browserVersion: "108.0.5359.29", // to update, check https://github.com/microsoft/playwright/releases
6
6
  coveragePlaywrightAPIAvailable: true,
7
7
  })
8
8
  export const chromiumIsolatedTab = chromium.isolatedTab
@@ -2,6 +2,6 @@ import { createRuntimeFromPlaywright } from "./from_playwright.js"
2
2
 
3
3
  export const firefox = createRuntimeFromPlaywright({
4
4
  browserName: "firefox",
5
- browserVersion: "103.0", // to update, check https://github.com/microsoft/playwright/releases
5
+ browserVersion: "106.0", // to update, check https://github.com/microsoft/playwright/releases
6
6
  })
7
7
  export const firefoxIsolatedTab = firefox.isolatedTab
@@ -2,7 +2,7 @@ import { createRuntimeFromPlaywright } from "./from_playwright.js"
2
2
 
3
3
  export const webkit = createRuntimeFromPlaywright({
4
4
  browserName: "webkit",
5
- browserVersion: "16.0", // to update, check https://github.com/microsoft/playwright/releases
5
+ browserVersion: "16.4", // to update, check https://github.com/microsoft/playwright/releases
6
6
  ignoreErrorHook: (error) => {
7
7
  // we catch error during execution but safari throw unhandled rejection
8
8
  // in a non-deterministic way.
@@ -63,26 +63,24 @@ export const jsenvPluginImportAssertions = ({
63
63
  transpilations.text = true
64
64
  }
65
65
  },
66
- redirectUrl: {
67
- js_import: (reference, context) => {
68
- if (!reference.assert) {
69
- return null
70
- }
71
- const { searchParams } = reference
72
- if (
73
- searchParams.has("as_json_module") ||
74
- searchParams.has("as_css_module") ||
75
- searchParams.has("as_text_module")
76
- ) {
77
- markAsJsModuleProxy(reference)
78
- return null
79
- }
80
- const type = reference.assert.type
81
- if (shouldTranspileImportAssertion(context, type)) {
82
- return turnIntoJsModuleProxy(reference, type)
83
- }
66
+ redirectUrl: (reference, context) => {
67
+ if (!reference.assert) {
84
68
  return null
85
- },
69
+ }
70
+ const { searchParams } = reference
71
+ if (
72
+ searchParams.has("as_json_module") ||
73
+ searchParams.has("as_css_module") ||
74
+ searchParams.has("as_text_module")
75
+ ) {
76
+ markAsJsModuleProxy(reference)
77
+ return null
78
+ }
79
+ const type = reference.assert.type
80
+ if (shouldTranspileImportAssertion(context, type)) {
81
+ return turnIntoJsModuleProxy(reference, type)
82
+ }
83
+ return null
86
84
  },
87
85
  }
88
86
  return [importAssertions, ...jsenvPluginAsModules()]
@@ -9,7 +9,6 @@ export const jsenvPluginReferenceExpectedTypes = () => {
9
9
  reference.isEntryPoint = true
10
10
  }
11
11
  if (searchParams.has("js_classic")) {
12
- searchParams.delete("js_classic")
13
12
  reference.expectedType = "js_classic"
14
13
  } else if (
15
14
  searchParams.has("as_js_classic") ||
@@ -19,7 +18,6 @@ export const jsenvPluginReferenceExpectedTypes = () => {
19
18
  } else if (searchParams.has("as_js_module")) {
20
19
  reference.expectedType = "js_module"
21
20
  } else if (searchParams.has("js_module")) {
22
- searchParams.delete("js_module")
23
21
  reference.expectedType = "js_module"
24
22
  } else if (
25
23
  reference.type === "js_url" &&
@@ -34,15 +32,11 @@ export const jsenvPluginReferenceExpectedTypes = () => {
34
32
 
35
33
  if (searchParams.has("worker")) {
36
34
  reference.expectedSubtype = "worker"
37
- searchParams.delete("worker")
38
35
  } else if (searchParams.has("service_worker")) {
39
36
  reference.expectedSubtype = "service_worker"
40
- searchParams.delete("service_worker")
41
37
  } else if (searchParams.has("shared_worker")) {
42
38
  reference.expectedSubtype = "shared_worker"
43
- searchParams.delete("shared_worker")
44
39
  }
45
-
46
40
  return urlObject.href
47
41
  }
48
42
 
@@ -52,6 +46,7 @@ export const jsenvPluginReferenceExpectedTypes = () => {
52
46
  redirectUrl: {
53
47
  script_src: redirectJsUrls,
54
48
  js_url: redirectJsUrls,
49
+ js_import: redirectJsUrls,
55
50
  },
56
51
  }
57
52
  }