@jsenv/core 27.0.0-alpha.72 → 27.0.0-alpha.73

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/dist/main.js CHANGED
@@ -2725,10 +2725,9 @@ export default inlineContent.text`
2725
2725
  return [asJsonModule, asCssModule, asTextModule];
2726
2726
  };
2727
2727
 
2728
- const require$4 = createRequire(import.meta.url);
2729
-
2730
- const babelPluginPackagePath = require$4.resolve("@jsenv/babel-plugins");
2728
+ const requireFromJsenv = createRequire(import.meta.url);
2731
2729
 
2730
+ const babelPluginPackagePath = requireFromJsenv.resolve("@jsenv/babel-plugins");
2732
2731
  const babelPluginPackageUrl = pathToFileURL(babelPluginPackagePath);
2733
2732
  const requireBabelPlugin = createRequire(babelPluginPackageUrl);
2734
2733
 
@@ -3112,9 +3111,6 @@ const jsenvPluginAsJsClassicWorkers = ({
3112
3111
  * But ideally babel should not generate this in the first place
3113
3112
  * and prefer to unique identifier based solely on the specifier basename for instance
3114
3113
  */
3115
-
3116
- const require$3 = createRequire(import.meta.url);
3117
-
3118
3114
  const jsenvPluginAsJsClassic = ({
3119
3115
  systemJsInjection
3120
3116
  }) => {
@@ -3254,11 +3250,11 @@ const convertJsModuleToJsClassic = async ({
3254
3250
  } = await applyBabelPlugins({
3255
3251
  babelPlugins: [...(jsClassicFormat === "system" ? [// propposal-dynamic-import required with systemjs for babel8:
3256
3252
  // https://github.com/babel/babel/issues/10746
3257
- require$3("@babel/plugin-proposal-dynamic-import"), [requireBabelPlugin("babel-plugin-transform-async-to-promises"), {
3253
+ requireFromJsenv("@babel/plugin-proposal-dynamic-import"), [requireBabelPlugin("babel-plugin-transform-async-to-promises"), {
3258
3254
  topLevelAwait: "return"
3259
- }], require$3("@babel/plugin-transform-modules-systemjs")] : [[requireBabelPlugin("babel-plugin-transform-async-to-promises"), {
3255
+ }], requireFromJsenv("@babel/plugin-transform-modules-systemjs")] : [[requireBabelPlugin("babel-plugin-transform-async-to-promises"), {
3260
3256
  topLevelAwait: "simple"
3261
- }], babelPluginTransformImportMetaUrl, require$3("@babel/plugin-transform-modules-umd")])],
3257
+ }], babelPluginTransformImportMetaUrl, requireFromJsenv("@babel/plugin-transform-modules-umd")])],
3262
3258
  urlInfo
3263
3259
  });
3264
3260
  let sourcemap = urlInfo.sourcemap;
@@ -5133,9 +5129,6 @@ const jsenvPluginBundling = bundling => {
5133
5129
  };
5134
5130
  };
5135
5131
 
5136
- const require$2 = createRequire(import.meta.url); // https://github.com/kangax/html-minifier#options-quick-reference
5137
-
5138
-
5139
5132
  const minifyHtml = ({
5140
5133
  htmlUrlInfo,
5141
5134
  options
@@ -5144,11 +5137,9 @@ const minifyHtml = ({
5144
5137
  collapseWhitespace = true,
5145
5138
  removeComments = true
5146
5139
  } = options;
5147
-
5148
5140
  const {
5149
5141
  minify
5150
- } = require$2("html-minifier");
5151
-
5142
+ } = requireFromJsenv("html-minifier");
5152
5143
  const htmlMinified = minify(htmlUrlInfo.content, {
5153
5144
  collapseWhitespace,
5154
5145
  removeComments
@@ -7965,8 +7956,6 @@ const determineFileUrlForOutDirectory = ({
7965
7956
  // }
7966
7957
  // }
7967
7958
 
7968
- const require$1 = createRequire(import.meta.url);
7969
-
7970
7959
  const parseUserAgentHeader = memoizeByFirstArgument(userAgent => {
7971
7960
  if (userAgent.includes("node-fetch/")) {
7972
7961
  // it's not really node and conceptually we can't assume the node version
@@ -7977,8 +7966,7 @@ const parseUserAgentHeader = memoizeByFirstArgument(userAgent => {
7977
7966
  };
7978
7967
  }
7979
7968
 
7980
- const UA = require$1("@financial-times/polyfill-useragent-normaliser");
7981
-
7969
+ const UA = requireFromJsenv("@financial-times/polyfill-useragent-normaliser");
7982
7970
  const {
7983
7971
  ua
7984
7972
  } = new UA(userAgent);
@@ -10693,15 +10681,11 @@ const getDebugInfo = processOptions => {
10693
10681
  // return typeof process.env.VSCODE_PID === "string"
10694
10682
  // }
10695
10683
 
10696
- const require = createRequire(import.meta.url); // see also https://github.com/sindresorhus/execa/issues/96
10697
-
10698
-
10699
10684
  const killProcessTree = async (processId, {
10700
10685
  signal,
10701
10686
  timeout = 2000
10702
10687
  }) => {
10703
- const pidtree = require("pidtree");
10704
-
10688
+ const pidtree = requireFromJsenv("pidtree");
10705
10689
  let descendantProcessIds;
10706
10690
 
10707
10691
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "27.0.0-alpha.72",
3
+ "version": "27.0.0-alpha.73",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -24,17 +24,16 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "import": {
27
- "development": "./main.js",
27
+ "development": "./src/main.js",
28
28
  "default": "./dist/main.js"
29
29
  }
30
30
  },
31
31
  "./*": "./*"
32
32
  },
33
- "main": "main.js",
33
+ "main": "./src/main.js",
34
34
  "files": [
35
35
  "/dist/",
36
- "/src/",
37
- "/main.js"
36
+ "/src/"
38
37
  ],
39
38
  "workspaces": [
40
39
  "./packages/*",
@@ -119,4 +118,4 @@
119
118
  "redux": "4.1.2",
120
119
  "rollup": "2.70.1"
121
120
  }
122
- }
121
+ }
@@ -1,13 +1,11 @@
1
- import { createRequire } from "node:module"
2
-
3
- const require = createRequire(import.meta.url)
1
+ import { requireFromJsenv } from "@jsenv/core/src/require_from_jsenv.js"
4
2
 
5
3
  // see also https://github.com/sindresorhus/execa/issues/96
6
4
  export const killProcessTree = async (
7
5
  processId,
8
6
  { signal, timeout = 2000 },
9
7
  ) => {
10
- const pidtree = require("pidtree")
8
+ const pidtree = requireFromJsenv("pidtree")
11
9
 
12
10
  let descendantProcessIds
13
11
  try {
package/src/main.js ADDED
@@ -0,0 +1,27 @@
1
+ // dev
2
+ export { startDevServer } from "./dev/start_dev_server.js"
3
+ // test
4
+ export {
5
+ executeTestPlan,
6
+ defaultCoverageConfig,
7
+ } from "./test/execute_test_plan.js"
8
+ export {
9
+ chromium,
10
+ chromiumIsolatedTab,
11
+ } from "./execute/runtimes/browsers/chromium.js"
12
+ export {
13
+ firefox,
14
+ firefoxIsolatedTab,
15
+ } from "./execute/runtimes/browsers/firefox.js"
16
+ export {
17
+ webkit,
18
+ webkitIsolatedTab,
19
+ } from "./execute/runtimes/browsers/webkit.js"
20
+ export { nodeProcess } from "./execute/runtimes/node/node_process.js"
21
+ // build
22
+ export { build } from "./build/build.js"
23
+ export { startBuildServer } from "./build/start_build_server.js"
24
+
25
+ // advanced
26
+ export { execute } from "./execute/execute.js"
27
+ export { injectGlobals } from "./plugins/inject_globals/jsenv_plugin_inject_globals.js"
@@ -1,8 +1,5 @@
1
- import { createRequire } from "node:module"
2
-
3
1
  import { memoizeByFirstArgument } from "@jsenv/utils/memoize/memoize_by_first_argument.js"
4
-
5
- const require = createRequire(import.meta.url)
2
+ import { requireFromJsenv } from "@jsenv/core/src/require_from_jsenv.js"
6
3
 
7
4
  export const parseUserAgentHeader = memoizeByFirstArgument((userAgent) => {
8
5
  if (userAgent.includes("node-fetch/")) {
@@ -13,7 +10,7 @@ export const parseUserAgentHeader = memoizeByFirstArgument((userAgent) => {
13
10
  runtimeVersion: process.version.slice(1),
14
11
  }
15
12
  }
16
- const UA = require("@financial-times/polyfill-useragent-normaliser")
13
+ const UA = requireFromJsenv("@financial-times/polyfill-useragent-normaliser")
17
14
  const { ua } = new UA(userAgent)
18
15
  const { family, major, minor, patch } = ua
19
16
  return {
@@ -1,12 +1,10 @@
1
- import { createRequire } from "node:module"
2
-
3
- const require = createRequire(import.meta.url)
1
+ import { requireFromJsenv } from "@jsenv/core/src/require_from_jsenv.js"
4
2
 
5
3
  // https://github.com/kangax/html-minifier#options-quick-reference
6
4
  export const minifyHtml = ({ htmlUrlInfo, options } = {}) => {
7
5
  const { collapseWhitespace = true, removeComments = true } = options
8
6
 
9
- const { minify } = require("html-minifier")
7
+ const { minify } = requireFromJsenv("html-minifier")
10
8
  const htmlMinified = minify(htmlUrlInfo.content, {
11
9
  collapseWhitespace,
12
10
  removeComments,
@@ -11,10 +11,10 @@
11
11
  * and prefer to unique identifier based solely on the specifier basename for instance
12
12
  */
13
13
 
14
- import { createRequire } from "node:module"
15
14
  import { urlToFilename, injectQueryParams } from "@jsenv/urls"
16
15
  import { readFileSync } from "@jsenv/filesystem"
17
16
 
17
+ import { requireFromJsenv } from "@jsenv/core/src/require_from_jsenv.js"
18
18
  import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
19
19
  import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
20
20
  import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js"
@@ -24,8 +24,6 @@ import { babelPluginTransformImportMetaUrl } from "./helpers/babel_plugin_transf
24
24
  import { jsenvPluginAsJsClassicHtml } from "./jsenv_plugin_as_js_classic_html.js"
25
25
  import { jsenvPluginAsJsClassicWorkers } from "./jsenv_plugin_as_js_classic_workers.js"
26
26
 
27
- const require = createRequire(import.meta.url)
28
-
29
27
  export const jsenvPluginAsJsClassic = ({ systemJsInjection }) => {
30
28
  const systemJsClientFileUrl = new URL(
31
29
  "./client/s.js?js_classic",
@@ -171,14 +169,14 @@ const convertJsModuleToJsClassic = async ({
171
169
  ? [
172
170
  // propposal-dynamic-import required with systemjs for babel8:
173
171
  // https://github.com/babel/babel/issues/10746
174
- require("@babel/plugin-proposal-dynamic-import"),
172
+ requireFromJsenv("@babel/plugin-proposal-dynamic-import"),
175
173
  [
176
174
  requireBabelPlugin("babel-plugin-transform-async-to-promises"),
177
175
  {
178
176
  topLevelAwait: "return",
179
177
  },
180
178
  ],
181
- require("@babel/plugin-transform-modules-systemjs"),
179
+ requireFromJsenv("@babel/plugin-transform-modules-systemjs"),
182
180
  ]
183
181
  : [
184
182
  [
@@ -188,7 +186,7 @@ const convertJsModuleToJsClassic = async ({
188
186
  },
189
187
  ],
190
188
  babelPluginTransformImportMetaUrl,
191
- require("@babel/plugin-transform-modules-umd"),
189
+ requireFromJsenv("@babel/plugin-transform-modules-umd"),
192
190
  ]),
193
191
  ],
194
192
  urlInfo,
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from "node:module"
2
2
  import { pathToFileURL } from "node:url"
3
+ import { requireFromJsenv } from "@jsenv/core/src/require_from_jsenv.js"
3
4
 
4
- const require = createRequire(import.meta.url)
5
- const babelPluginPackagePath = require.resolve("@jsenv/babel-plugins")
5
+ const babelPluginPackagePath = requireFromJsenv.resolve("@jsenv/babel-plugins")
6
6
  const babelPluginPackageUrl = pathToFileURL(babelPluginPackagePath)
7
7
 
8
8
  export const requireBabelPlugin = createRequire(babelPluginPackageUrl)
@@ -0,0 +1,3 @@
1
+ import { createRequire } from "node:module"
2
+
3
+ export const requireFromJsenv = createRequire(import.meta.url)
package/main.js DELETED
@@ -1,27 +0,0 @@
1
- // dev
2
- export { startDevServer } from "./src/dev/start_dev_server.js"
3
- // test
4
- export {
5
- executeTestPlan,
6
- defaultCoverageConfig,
7
- } from "./src/test/execute_test_plan.js"
8
- export {
9
- chromium,
10
- chromiumIsolatedTab,
11
- } from "./src/execute/runtimes/browsers/chromium.js"
12
- export {
13
- firefox,
14
- firefoxIsolatedTab,
15
- } from "./src/execute/runtimes/browsers/firefox.js"
16
- export {
17
- webkit,
18
- webkitIsolatedTab,
19
- } from "./src/execute/runtimes/browsers/webkit.js"
20
- export { nodeProcess } from "./src/execute/runtimes/node/node_process.js"
21
- // build
22
- export { build } from "./src/build/build.js"
23
- export { startBuildServer } from "./src/build/start_build_server.js"
24
-
25
- // advanced
26
- export { execute } from "./src/execute/execute.js"
27
- export { injectGlobals } from "./src/plugins/inject_globals/jsenv_plugin_inject_globals.js"