@jsenv/core 27.0.0-alpha.0 → 27.0.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "27.0.0-alpha.0",
3
+ "version": "27.0.0-alpha.3",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,8 +11,7 @@
11
11
  "node": ">=16.13.0"
12
12
  },
13
13
  "publishConfig": {
14
- "access": "public",
15
- "registry": "https://registry.npmjs.org"
14
+ "access": "public"
16
15
  },
17
16
  "type": "module",
18
17
  "imports": {},
@@ -107,4 +106,4 @@
107
106
  "redux": "4.1.2",
108
107
  "rollup": "2.70.1"
109
108
  }
110
- }
109
+ }
@@ -1,4 +1,4 @@
1
- import { uneval } from "@jsenv/core/node_modules/@jsenv/uneval/index.js" // WHY?
1
+ import { uneval } from "@jsenv/uneval"
2
2
 
3
3
  export const unevalException = (value) => {
4
4
  if (value && value.hasOwnProperty("toString")) {
@@ -24,7 +24,7 @@ import {
24
24
  removeHtmlNodeText,
25
25
  getHtmlNodeTextNode,
26
26
  } from "@jsenv/utils/html_ast/html_ast.js"
27
- import { generateInlineContentUrl } from "@jsenv/core/packages/utils/urls/inline_content_url_generator.js"
27
+ import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js"
28
28
 
29
29
  export const jsenvPluginHtmlSupervisor = ({
30
30
  logs = false,
@@ -32,26 +32,36 @@ export const jsenvPluginImportMetaScenarios = () => {
32
32
  }
33
33
  if (scenario === "dev") {
34
34
  dev.forEach((path) => {
35
- replace(path, true)
35
+ replace(path, "true")
36
36
  })
37
37
  } else if (scenario === "test") {
38
+ // test is also considered a dev environment
39
+ // just like the dev server can be used to debug test files
40
+ // without this people would have to write
41
+ // if (import.meta.dev || import.meta.test) or if (!import.meta.build)
42
+ dev.forEach((path) => {
43
+ replace(path, "true")
44
+ })
38
45
  test.forEach((path) => {
39
- replace(path, true)
46
+ replace(path, "true")
40
47
  })
41
48
  } else if (scenario === "build") {
49
+ // replacing by undefined might not be required
50
+ // as I suppose rollup would consider them as undefined
51
+ // but let's make it explicit to ensure code is properly tree-shaked
42
52
  dev.forEach((path) => {
43
- replace(path, undefined)
53
+ replace(path, "undefined")
44
54
  })
45
55
  test.forEach((path) => {
46
- replace(path, undefined)
56
+ replace(path, "undefined")
47
57
  })
48
58
  build.forEach((path) => {
49
- replace(path, true)
59
+ replace(path, "true")
50
60
  })
51
61
  }
52
62
  const magicSource = createMagicSource(content)
53
63
  replacements.forEach(({ path, value }) => {
54
- magicSource.overwrite({
64
+ magicSource.replace({
55
65
  start: path.node.start,
56
66
  end: path.node.end,
57
67
  replacement: value,
@@ -35,7 +35,7 @@ import {
35
35
  getHtmlNodeTextNode,
36
36
  removeHtmlNode,
37
37
  } from "@jsenv/utils/html_ast/html_ast.js"
38
- import { generateInlineContentUrl } from "@jsenv/core/packages/utils/urls/inline_content_url_generator.js"
38
+ import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js"
39
39
 
40
40
  export const jsenvPluginImportmap = () => {
41
41
  let finalImportmap = null
@@ -9,7 +9,7 @@ import {
9
9
  getHtmlNodeAttributeByName,
10
10
  } from "@jsenv/utils/html_ast/html_ast.js"
11
11
  import { injectQueryParams } from "@jsenv/utils/urls/url_utils.js"
12
- import { generateInlineContentUrl } from "@jsenv/core/packages/utils/urls/inline_content_url_generator.js"
12
+ import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js"
13
13
 
14
14
  export const jsenvPluginJsAndCssInsideHtml = () => {
15
15
  return {
@@ -1,4 +1,4 @@
1
- import { createMagicSource } from "@jsenv/core/packages/utils/sourcemap/magic_source.js"
1
+ import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
2
2
 
3
3
  export const jsenvPluginImportScriptsBundler = () => {
4
4
  return {