@jsenv/core 23.8.3 → 23.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "23.8.3",
3
+ "version": "23.8.9",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -67,10 +67,10 @@
67
67
  "@c88/v8-coverage": "0.1.1",
68
68
  "@jsenv/abort": "4.1.1",
69
69
  "@jsenv/filesystem": "2.5.1",
70
- "@jsenv/importmap": "1.1.0",
70
+ "@jsenv/importmap": "1.2.0",
71
71
  "@jsenv/log": "1.4.0",
72
72
  "@jsenv/logger": "4.0.1",
73
- "@jsenv/server": "10.0.9",
73
+ "@jsenv/server": "10.0.11",
74
74
  "@jsenv/uneval": "1.6.0",
75
75
  "@jsenv/workers": "1.2.0",
76
76
  "@rollup/plugin-commonjs": "21.0.0",
@@ -121,11 +121,11 @@
121
121
  "@babel/preset-env": "7.15.8",
122
122
  "@jsenv/assert": "2.3.2",
123
123
  "@jsenv/babel-preset": "./packages/jsenv-babel-preset",
124
- "@jsenv/eslint-config": "16.0.8",
124
+ "@jsenv/eslint-config": "16.0.9",
125
125
  "@jsenv/github-release-package": "1.2.3",
126
- "@jsenv/https-local": "1.0.2",
126
+ "@jsenv/https-local": "1.0.3",
127
127
  "@jsenv/importmap-eslint-resolver": "5.1.2",
128
- "@jsenv/importmap-node-module": "2.4.1",
128
+ "@jsenv/importmap-node-module": "2.7.0",
129
129
  "@jsenv/package-publish": "1.6.2",
130
130
  "@jsenv/performance-impact": "2.2.1",
131
131
  "@jsenv/prettier-check-project": "5.6.1",
@@ -1,3 +1,5 @@
1
+ /* eslint-env browser */
2
+
1
3
  export const displayErrorInDocument = (error) => {
2
4
  const title = "An error occured"
3
5
  let theme
@@ -1,3 +1,4 @@
1
+ /* eslint-env browser */
1
2
  const { Notification } = window
2
3
 
3
4
  const displayErrorNotificationNotAvailable = () => {}
@@ -186,6 +186,14 @@ const executeSource = async ({
186
186
  coverage,
187
187
  }
188
188
  })
189
+ } else {
190
+ transformResult = composeTransformer(transformResult, (result) => {
191
+ const { namespace: fileExecutionResultMap } = result
192
+ Object.keys(fileExecutionResultMap).forEach((fileRelativeUrl) => {
193
+ delete fileExecutionResultMap[fileRelativeUrl].coverage
194
+ })
195
+ return result
196
+ })
189
197
  }
190
198
 
191
199
  const fileClientUrl = resolveUrl(fileRelativeUrl, `${compileServerOrigin}/`)
@@ -7,6 +7,9 @@ import { fetchUrl } from "../browser-utils/fetch-browser.js"
7
7
  import { fetchAndEvalUsingFetch } from "../browser-utils/fetchAndEvalUsingFetch.js"
8
8
  import { memoize } from "../memoize.js"
9
9
 
10
+ import { displayErrorInDocument } from "./displayErrorInDocument.js"
11
+ import { displayErrorNotification } from "./displayErrorNotification.js"
12
+
10
13
  const getNavigationStartTime = () => {
11
14
  try {
12
15
  return window.performance.timing.navigationStart
@@ -73,13 +76,15 @@ const executeFileUsingDynamicImport = async (
73
76
  const executionResult = {
74
77
  status: "completed",
75
78
  namespace,
79
+ coverage: readCoverage(),
76
80
  }
77
81
  return executionResult
78
82
  } catch (e) {
79
83
  performance.measure(`jsenv_file_import`, `jsenv_file_import_start`)
80
84
  const executionResult = {
81
85
  status: "errored",
82
- exceptionSource: unevalException(e),
86
+ error: e,
87
+ coverage: readCoverage(),
83
88
  }
84
89
  onExecutionError(executionResult, { currentScript })
85
90
  return executionResult
@@ -112,16 +117,23 @@ const executeFileUsingSystemJs = (specifier) => {
112
117
  return fileExecutionResultPromise
113
118
  }
114
119
 
115
- const onExecutionError = (executionResult, { currentScript }) => {
116
- // eslint-disable-next-line no-eval
117
- const originalError = window.eval(executionResult.exceptionSource)
118
- if (originalError.code === "NETWORK_FAILURE") {
120
+ const onExecutionError = (
121
+ executionResult,
122
+ {
123
+ currentScript,
124
+ errorExposureInConsole = true,
125
+ errorExposureInNotification = false,
126
+ errorExposureInDocument = true,
127
+ },
128
+ ) => {
129
+ const error = executionResult.error
130
+ if (error.code === "NETWORK_FAILURE") {
119
131
  if (currentScript) {
120
132
  const errorEvent = new Event("error")
121
133
  currentScript.dispatchEvent(errorEvent)
122
134
  }
123
135
  } else {
124
- const { parsingError } = originalError
136
+ const { parsingError } = error
125
137
  const globalErrorEvent = new Event("error")
126
138
  if (parsingError) {
127
139
  globalErrorEvent.filename = parsingError.filename
@@ -129,13 +141,26 @@ const onExecutionError = (executionResult, { currentScript }) => {
129
141
  globalErrorEvent.message = parsingError.message
130
142
  globalErrorEvent.colno = parsingError.columnNumber
131
143
  } else {
132
- globalErrorEvent.filename = originalError.filename
133
- globalErrorEvent.lineno = originalError.lineno
134
- globalErrorEvent.message = originalError.message
135
- globalErrorEvent.colno = originalError.columnno
144
+ globalErrorEvent.filename = error.filename
145
+ globalErrorEvent.lineno = error.lineno
146
+ globalErrorEvent.message = error.message
147
+ globalErrorEvent.colno = error.columnno
136
148
  }
137
149
  window.dispatchEvent(globalErrorEvent)
138
150
  }
151
+
152
+ if (errorExposureInConsole) {
153
+ console.error(error)
154
+ }
155
+ if (errorExposureInNotification) {
156
+ displayErrorNotification(error)
157
+ }
158
+ if (errorExposureInDocument) {
159
+ displayErrorInDocument(error)
160
+ }
161
+
162
+ executionResult.exceptionSource = unevalException(error)
163
+ delete executionResult.error
139
164
  }
140
165
 
141
166
  const getBrowserRuntime = memoize(async () => {
@@ -191,6 +216,8 @@ const getBrowserRuntime = memoize(async () => {
191
216
 
192
217
  const livereloadingCallbacks = {}
193
218
 
219
+ const readCoverage = () => window.__coverage__
220
+
194
221
  window.__jsenv__ = {
195
222
  livereloadingCallbacks,
196
223
  executionResultPromise,
@@ -14,6 +14,7 @@ import {
14
14
  isNodePartOfSupportedRuntimes,
15
15
  isBrowserPartOfSupportedRuntimes,
16
16
  } from "@jsenv/core/src/internal/generateGroupMap/runtime_support.js"
17
+ import { featuresCompatMap } from "@jsenv/core/src/internal/generateGroupMap/featuresCompatMap.js"
17
18
  import { createRuntimeCompat } from "@jsenv/core/src/internal/generateGroupMap/runtime_compat.js"
18
19
  import { createJsenvRollupPlugin } from "./createJsenvRollupPlugin.js"
19
20
 
@@ -71,16 +72,7 @@ export const buildUsingRollup = async ({
71
72
  import_assertion_type_json: true,
72
73
  import_assertion_type_css: true,
73
74
  },
74
- pluginCompatMap: {
75
- import_assertion_type_json: {
76
- chrome: "91",
77
- edge: "91",
78
- },
79
- import_assertion_type_css: {
80
- chrome: "93",
81
- edge: "93",
82
- },
83
- },
75
+ pluginCompatMap: featuresCompatMap,
84
76
  })
85
77
  const importAssertionsSupport = {
86
78
  json:
@@ -2,6 +2,13 @@ import { urlToFilename } from "@jsenv/filesystem"
2
2
 
3
3
  export const urlIsCompilationAsset = (url) => {
4
4
  const filename = urlToFilename(url)
5
+
6
+ // sourcemap are not inside the asset folder because
7
+ // of https://github.com/microsoft/vscode-chrome-debug-core/issues/544
8
+ if (filename.endsWith(".map")) {
9
+ return true
10
+ }
11
+
5
12
  return filename.includes("__asset__")
6
13
  }
7
14
 
@@ -88,7 +88,9 @@ export const compileFile = async ({
88
88
  } = compileResult
89
89
 
90
90
  if (compileResultStatus !== "cached" && compileCacheStrategy !== "none") {
91
- updateMeta({
91
+ // we MUST await updateMeta otherwise we might get 404
92
+ // when serving sourcemap files
93
+ await updateMeta({
92
94
  logger,
93
95
  meta,
94
96
  compileResult,
@@ -142,6 +144,7 @@ export const compileFile = async ({
142
144
  headers: {
143
145
  "content-length": Buffer.byteLength(compiledSource),
144
146
  "content-type": contentType,
147
+ "cache-control": "no-store",
145
148
  ...responseHeaders,
146
149
  },
147
150
  body: compiledSource,
@@ -158,12 +161,16 @@ export const compileFile = async ({
158
161
  ) {
159
162
  return {
160
163
  status: 304,
164
+ headers: {
165
+ "cache-control": "private,max-age=0,must-revalidate",
166
+ },
161
167
  timing,
162
168
  }
163
169
  }
164
170
  return respondUsingRAM((response) => {
165
171
  // eslint-disable-next-line dot-notation
166
172
  response.headers["etag"] = compiledEtag
173
+ response.headers["cache-control"] = "private,max-age=0,must-revalidate"
167
174
  })
168
175
  }
169
176
 
@@ -174,6 +181,9 @@ export const compileFile = async ({
174
181
  ) {
175
182
  return {
176
183
  status: 304,
184
+ headers: {
185
+ "cache-control": "private,max-age=0,must-revalidate",
186
+ },
177
187
  timing,
178
188
  }
179
189
  }
@@ -181,6 +191,7 @@ export const compileFile = async ({
181
191
  response.headers["last-modified"] = new Date(
182
192
  compiledMtime,
183
193
  ).toUTCString()
194
+ response.headers["cache-control"] = "private,max-age=0,must-revalidate"
184
195
  })
185
196
  }
186
197
 
@@ -279,7 +279,6 @@ const inlineImportmapScripts = async ({ logger, htmlAst, htmlFileUrl }) => {
279
279
  },
280
280
  ),
281
281
  )
282
-
283
282
  return
284
283
  }
285
284
 
@@ -206,7 +206,9 @@ export const jsenvTransform = async ({
206
206
  ...(moduleOutFormat === "systemjs"
207
207
  ? {
208
208
  "proposal-dynamic-import": [proposalDynamicImport],
209
- "transform-modules-systemjs": [transformModulesSystemJs],
209
+ ...(moduleOutFormat === "systemjs"
210
+ ? { "transform-modules-systemjs": [transformModulesSystemJs] }
211
+ : {}),
210
212
  }
211
213
  : {}),
212
214
  }),
@@ -1,10 +1,13 @@
1
1
  import { resolveUrl, urlToRelativeUrl } from "@jsenv/filesystem"
2
+ import { moveImportMap, composeTwoImportMaps } from "@jsenv/importmap"
3
+ import { createDetailedMessage } from "@jsenv/logger"
2
4
 
3
5
  import {
4
6
  jsenvBrowserSystemFileInfo,
5
7
  jsenvToolbarHtmlFileInfo,
6
8
  jsenvToolbarInjectorFileInfo,
7
9
  } from "@jsenv/core/src/internal/jsenvInternalFiles.js"
10
+ import { fetchUrl } from "@jsenv/core/src/internal/fetchUrl.js"
8
11
  import { getDefaultImportMap } from "@jsenv/core/src/internal/import-resolution/importmap-default.js"
9
12
  import {
10
13
  setJavaScriptSourceMappingUrl,
@@ -26,11 +29,10 @@ import {
26
29
  replaceHtmlNode,
27
30
  } from "./compileHtml.js"
28
31
  import { generateCompiledFileAssetUrl } from "./compile-directory/compile-asset.js"
29
- import { composeTwoImportMaps } from "@jsenv/importmap"
30
32
 
31
33
  export const compileHtml = async ({
32
34
  // cancellationToken,
33
- // logger,
35
+ logger,
34
36
  // request,
35
37
  code,
36
38
  url,
@@ -89,17 +91,29 @@ export const compileHtml = async ({
89
91
 
90
92
  let hasImportmap = false
91
93
  const inlineScriptsContentMap = {}
94
+ const importmapsToInline = []
92
95
  scripts.forEach((script) => {
93
96
  const typeAttribute = getHtmlNodeAttributeByName(script, "type")
94
97
  const srcAttribute = getHtmlNodeAttributeByName(script, "src")
95
98
 
96
99
  // importmap
97
100
  if (typeAttribute && typeAttribute.value === "importmap") {
101
+ hasImportmap = true
102
+
98
103
  if (srcAttribute) {
99
- hasImportmap = true
100
- typeAttribute.value = "jsenv-importmap"
104
+ if (moduleOutFormat === "systemjs") {
105
+ typeAttribute.value = "jsenv-importmap"
106
+ return // no need to inline
107
+ }
108
+
109
+ // we force inline because browsers supporting importmap supports only when they are inline
110
+ importmapsToInline.push({
111
+ script,
112
+ src: srcAttribute.value,
113
+ })
101
114
  return
102
115
  }
116
+
103
117
  const defaultImportMap = getDefaultImportMap({
104
118
  importMapFileUrl: compiledUrl,
105
119
  projectDirectoryUrl,
@@ -107,40 +121,51 @@ export const compileHtml = async ({
107
121
  })
108
122
  const inlineImportMap = JSON.parse(getHtmlNodeTextNode(script).value)
109
123
  const mappings = composeTwoImportMaps(defaultImportMap, inlineImportMap)
110
- hasImportmap = true
111
- typeAttribute.value = "jsenv-importmap"
124
+ if (moduleOutFormat === "systemjs") {
125
+ typeAttribute.value = "jsenv-importmap"
126
+ }
112
127
  setHtmlNodeText(script, JSON.stringify(mappings, null, " "))
113
128
  return
114
129
  }
115
130
 
131
+ // remote module script
116
132
  if (typeAttribute && typeAttribute.value === "module" && srcAttribute) {
117
- removeHtmlNodeAttribute(script, typeAttribute)
133
+ if (moduleOutFormat === "systemjs") {
134
+ removeHtmlNodeAttribute(script, typeAttribute)
135
+ }
118
136
  removeHtmlNodeAttribute(script, srcAttribute)
137
+ const src = srcAttribute.value
138
+ const jsenvMethod =
139
+ moduleOutFormat === "systemjs"
140
+ ? "executeFileUsingSystemJs"
141
+ : "executeFileUsingDynamicImport"
119
142
  setHtmlNodeText(
120
143
  script,
121
- `window.__jsenv__.executeFileUsingSystemJs(${JSON.stringify(
122
- srcAttribute.value,
123
- )})`,
144
+ `window.__jsenv__.${jsenvMethod}(${JSON.stringify(src)})`,
124
145
  )
125
146
  return
126
147
  }
127
- // inline
148
+
149
+ // inline module script
128
150
  const textNode = getHtmlNodeTextNode(script)
129
151
  if (typeAttribute && typeAttribute.value === "module" && textNode) {
152
+ if (moduleOutFormat === "systemjs") {
153
+ removeHtmlNodeAttribute(script, typeAttribute)
154
+ }
155
+ removeHtmlNodeAttribute(script, srcAttribute)
130
156
  const scriptAssetUrl = generateCompiledFileAssetUrl(
131
157
  compiledUrl,
132
158
  getUniqueNameForInlineHtmlNode(script, scripts, `[id].js`),
133
159
  )
134
160
  const specifier = `./${urlToRelativeUrl(scriptAssetUrl, compiledUrl)}`
135
161
  inlineScriptsContentMap[specifier] = textNode.value
136
-
137
- removeHtmlNodeAttribute(script, typeAttribute)
138
- removeHtmlNodeAttribute(script, srcAttribute)
162
+ const jsenvMethod =
163
+ moduleOutFormat === "systemjs"
164
+ ? "executeFileUsingSystemJs"
165
+ : "executeFileUsingDynamicImport"
139
166
  setHtmlNodeText(
140
167
  script,
141
- `window.__jsenv__.executeFileUsingSystemJs(${JSON.stringify(
142
- specifier,
143
- )})`,
168
+ `window.__jsenv__.${jsenvMethod}(${JSON.stringify(specifier)})`,
144
169
  )
145
170
  htmlDependencies.push({
146
171
  htmlNode: script,
@@ -149,17 +174,18 @@ export const compileHtml = async ({
149
174
  return
150
175
  }
151
176
  })
177
+
152
178
  if (hasImportmap === false) {
153
179
  const defaultImportMap = getDefaultImportMap({
154
180
  importMapFileUrl: compiledUrl,
155
181
  projectDirectoryUrl,
156
182
  compileDirectoryRelativeUrl: `${outDirectoryRelativeUrl}${compileId}/`,
157
183
  })
158
-
159
184
  manipulateHtmlAst(htmlAst, {
160
185
  scriptInjections: [
161
186
  {
162
- type: "jsenv-importmap",
187
+ type:
188
+ moduleOutFormat === "systemjs" ? "jsenv-importmap" : "importmap",
163
189
  // in case there is no importmap, force the presence
164
190
  // so that '@jsenv/core/' are still remapped
165
191
  text: JSON.stringify(defaultImportMap, null, " "),
@@ -168,6 +194,46 @@ export const compileHtml = async ({
168
194
  })
169
195
  }
170
196
 
197
+ await Promise.all(
198
+ importmapsToInline.map(async ({ script, src }) => {
199
+ const importMapUrl = resolveUrl(src, url)
200
+ const importMapResponse = await fetchUrl(importMapUrl)
201
+ if (importMapResponse.status !== 200) {
202
+ logger.warn(
203
+ createDetailedMessage(
204
+ importMapResponse.status === 404
205
+ ? `Cannot inline importmap script because file cannot be found.`
206
+ : `Cannot inline importmap script due to unexpected response status (${importMapResponse.status}).`,
207
+ {
208
+ "importmap script src": src,
209
+ "importmap url": importMapUrl,
210
+ "html url": url,
211
+ },
212
+ ),
213
+ )
214
+ return
215
+ }
216
+
217
+ const importMapContent = await importMapResponse.json()
218
+ const importMapInlined = moveImportMap(
219
+ importMapContent,
220
+ importMapUrl,
221
+ url,
222
+ )
223
+ replaceHtmlNode(
224
+ script,
225
+ `<script type="importmap">${JSON.stringify(
226
+ importMapInlined,
227
+ null,
228
+ " ",
229
+ )}</script>`,
230
+ {
231
+ attributesToIgnore: ["src"],
232
+ },
233
+ )
234
+ }),
235
+ )
236
+
171
237
  const htmlAfterTransformation = stringifyHtmlAst(htmlAst)
172
238
 
173
239
  let assets = []
@@ -33,6 +33,8 @@ import { isBrowserPartOfSupportedRuntimes } from "@jsenv/core/src/internal/gener
33
33
  import { loadBabelPluginMapFromFile } from "./load_babel_plugin_map_from_file.js"
34
34
  import { extractSyntaxBabelPluginMap } from "./babel_plugins.js"
35
35
  import { generateGroupMap } from "../generateGroupMap/generateGroupMap.js"
36
+ import { featuresCompatMap } from "@jsenv/core/src/internal/generateGroupMap/featuresCompatMap.js"
37
+ import { createRuntimeCompat } from "@jsenv/core/src/internal/generateGroupMap/runtime_compat.js"
36
38
  import {
37
39
  jsenvCompileProxyFileInfo,
38
40
  sourcemapMainFileInfo,
@@ -69,8 +71,8 @@ export const startCompileServer = async ({
69
71
 
70
72
  // js compile options
71
73
  transformTopLevelAwait = true,
72
- moduleOutFormat = "systemjs",
73
- importMetaFormat = moduleOutFormat,
74
+ moduleOutFormat,
75
+ importMetaFormat,
74
76
  env = {},
75
77
  processEnvNodeEnv = process.env.NODE_ENV,
76
78
  replaceProcessEnvNodeEnv = true,
@@ -219,6 +221,15 @@ export const startCompileServer = async ({
219
221
  ...babelPluginMap,
220
222
  }
221
223
 
224
+ if (moduleOutFormat === undefined) {
225
+ moduleOutFormat = canAvoidSystemJs({ runtimeSupport })
226
+ ? "esmodule"
227
+ : "systemjs"
228
+ }
229
+ if (importMetaFormat === undefined) {
230
+ importMetaFormat = moduleOutFormat
231
+ }
232
+
222
233
  const serverStopCallbackList = createCallbackListNotifiedOnce()
223
234
 
224
235
  let projectFileRequestedCallback = () => {}
@@ -589,24 +600,33 @@ const setupServerSentEventsForLivereload = ({
589
600
  ...livereloadWatchConfig,
590
601
  [jsenvDirectoryRelativeUrl]: false,
591
602
  }
592
- const unregisterDirectoryLifecyle = registerDirectoryLifecycle(
593
- projectDirectoryUrl,
594
- {
595
- watchDescription,
596
- updated: ({ relativeUrl }) => {
597
- projectFileModified.notify(relativeUrl)
598
- },
599
- removed: ({ relativeUrl }) => {
600
- projectFileRemoved.notify(relativeUrl)
601
- },
602
- added: ({ relativeUrl }) => {
603
- projectFileAdded.notify(relativeUrl)
603
+
604
+ // wait 100ms to actually start watching
605
+ // otherwise server starting is delayed by the filesystem scan done in
606
+ // registerDirectoryLifecycle
607
+ const timeout = setTimeout(() => {
608
+ const unregisterDirectoryLifecyle = registerDirectoryLifecycle(
609
+ projectDirectoryUrl,
610
+ {
611
+ watchDescription,
612
+ updated: ({ relativeUrl }) => {
613
+ projectFileModified.notify(relativeUrl)
614
+ },
615
+ removed: ({ relativeUrl }) => {
616
+ projectFileRemoved.notify(relativeUrl)
617
+ },
618
+ added: ({ relativeUrl }) => {
619
+ projectFileAdded.notify(relativeUrl)
620
+ },
621
+ keepProcessAlive: false,
622
+ recursive: true,
604
623
  },
605
- keepProcessAlive: false,
606
- recursive: true,
607
- },
608
- )
609
- serverStopCallbackList.add(unregisterDirectoryLifecyle)
624
+ )
625
+ serverStopCallbackList.add(unregisterDirectoryLifecyle)
626
+ }, 100)
627
+ serverStopCallbackList.add(() => {
628
+ clearTimeout(timeout)
629
+ })
610
630
 
611
631
  const getDependencySet = (mainRelativeUrl) => {
612
632
  if (trackerMap.has(mainRelativeUrl)) {
@@ -1040,6 +1060,20 @@ const createCompileProxyService = ({ projectDirectoryUrl }) => {
1040
1060
  }
1041
1061
  }
1042
1062
 
1063
+ const canAvoidSystemJs = ({ runtimeSupport }) => {
1064
+ const runtimeCompatMap = createRuntimeCompat({
1065
+ runtimeSupport,
1066
+ pluginMap: {
1067
+ module: true,
1068
+ importmap: true,
1069
+ import_assertion_type_json: true,
1070
+ import_assertion_type_css: true,
1071
+ },
1072
+ pluginCompatMap: featuresCompatMap,
1073
+ })
1074
+ return runtimeCompatMap.pluginRequiredNameArray.length === 0
1075
+ }
1076
+
1043
1077
  const readPackage = (packagePath) => {
1044
1078
  const buffer = readFileSync(packagePath)
1045
1079
  const string = String(buffer)
@@ -118,7 +118,13 @@ export const reportToCoverage = async (
118
118
  fileByFileCoverage,
119
119
  babelPluginMap,
120
120
  })
121
- Object.assign(fileByFileCoverage, missingFileByFileCoverage)
121
+ Object.assign(
122
+ fileByFileCoverage,
123
+ normalizeFileByFileCoveragePaths(
124
+ missingFileByFileCoverage,
125
+ projectDirectoryUrl,
126
+ ),
127
+ )
122
128
  }
123
129
 
124
130
  return fileByFileCoverage
@@ -0,0 +1,29 @@
1
+ // https://github.com/babel/babel/blob/master/packages/babel-compat-data/data/native-modules.json#L1
2
+
3
+ export const featuresCompatMap = {
4
+ module: {
5
+ edge: "16",
6
+ firefox: "60",
7
+ chrome: "61",
8
+ safari: "10.1",
9
+ opera: "48",
10
+ ios: "10.3",
11
+ android: "61",
12
+ samsung: "8.2",
13
+ },
14
+ // https://caniuse.com/import-maps
15
+ importmap: {
16
+ edge: "89",
17
+ chrome: "89",
18
+ opera: "76",
19
+ samsung: "15",
20
+ },
21
+ import_assertion_type_json: {
22
+ chrome: "91",
23
+ edge: "91",
24
+ },
25
+ import_assertion_type_css: {
26
+ chrome: "93",
27
+ edge: "93",
28
+ },
29
+ }
@@ -443,14 +443,7 @@ jsenvBabelPluginCompatMap["global-this-as-jsenv-import"] = {
443
443
  node: "12",
444
444
  }
445
445
 
446
- // jsenvBabelPluginCompatMap["transform-import-assertion-json"] = {
447
- // chrome: "91",
448
- // edge: "91",
449
- // }
450
- // jsenvBabelPluginCompatMap["transform-import-assertion-css"] = {
451
- // chrome: "93",
452
- // edge: "93",
453
- // }
446
+ // needs support for both json and css
454
447
  jsenvBabelPluginCompatMap["transform-import-assertions"] = {
455
448
  chrome: "93",
456
449
  edge: "93",