@jsenv/core 25.0.1 → 25.2.1
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/browser_runtime/browser_runtime_91c5a3b8.js.map +2 -2
- package/dist/build_manifest.js +4 -4
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/{compile_proxy_e3b0c442_809f35f7.js.map → compile_proxy.html__inline__20_809f35f7.js.map} +0 -0
- package/dist/compile_proxy/{compile_proxy_7ad5faa6.html → compile_proxy_8dfaee51.html} +3 -4
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/{redirector_e3b0c442_e391410e.js.map → redirector.html__inline__15_e391410e.js.map} +0 -0
- package/dist/redirector/{redirector_eb92e8a7.html → redirector_3e9a97b9.html} +3 -4
- package/dist/toolbar/asset-manifest.json +1 -1
- package/dist/toolbar/{toolbar_f7b8a263.html → toolbar_361afb84.html} +2 -3
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/{toolbar_injector_49e4756e.js → toolbar_injector_fac1e995.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector_49e4756e.js.map → toolbar_injector_fac1e995.js.map} +2 -2
- package/package.json +9 -10
- package/readme.md +60 -51
- package/src/buildProject.js +21 -13
- package/src/commonJsToJavaScriptModule.js +8 -7
- package/src/dev_server.js +2 -0
- package/src/execute.js +2 -0
- package/src/executeTestPlan.js +14 -0
- package/src/internal/building/buildUsingRollup.js +4 -2
- package/src/internal/building/build_stats.js +3 -0
- package/src/internal/building/build_url_generator.js +153 -0
- package/src/internal/building/css/parseCssRessource.js +32 -26
- package/src/internal/building/html/parseHtmlRessource.js +109 -91
- package/src/internal/building/js/parseJsRessource.js +5 -13
- package/src/internal/building/parseRessource.js +3 -0
- package/src/internal/building/ressource_builder.js +72 -64
- package/src/internal/building/ressource_builder_util.js +17 -5
- package/src/internal/building/rollup_plugin_jsenv.js +262 -189
- package/src/internal/building/url_fetcher.js +16 -7
- package/src/internal/building/url_loader.js +1 -5
- package/src/internal/building/url_versioning.js +0 -173
- package/src/internal/compiling/babel_plugin_import_metadata.js +7 -11
- package/src/internal/compiling/babel_plugin_proxy_external_imports.js +31 -0
- package/src/internal/compiling/compile-directory/compile-asset.js +8 -4
- package/src/internal/compiling/compile-directory/getOrGenerateCompiledFile.js +43 -8
- package/src/internal/compiling/compile-directory/updateMeta.js +4 -8
- package/src/internal/compiling/compile-directory/validateCache.js +1 -2
- package/src/internal/compiling/compileFile.js +22 -10
- package/src/internal/compiling/compileHtml.js +15 -28
- package/src/internal/compiling/createCompiledFileService.js +22 -24
- package/src/internal/compiling/html_source_file_service.js +18 -19
- package/src/internal/compiling/js-compilation-service/babelHelper.js +10 -13
- package/src/internal/compiling/js-compilation-service/babel_plugin_babel_helpers_as_jsenv_imports.js +4 -2
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +16 -7
- package/src/internal/compiling/js-compilation-service/transformJs.js +9 -5
- package/src/internal/compiling/jsenvCompilerForHtml.js +536 -262
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +15 -11
- package/src/internal/compiling/startCompileServer.js +83 -20
- package/src/internal/compiling/transformResultToCompilationResult.js +47 -25
- package/src/internal/executing/executePlan.js +2 -0
- package/src/internal/fetchUrl.js +3 -2
- package/src/internal/integrity/integrity_algorithms.js +26 -0
- package/src/internal/integrity/integrity_parsing.js +50 -0
- package/src/internal/integrity/integrity_update.js +23 -0
- package/src/internal/integrity/integrity_validation.js +49 -0
- package/src/internal/jsenvCoreDirectoryUrl.js +2 -0
- package/src/internal/jsenv_remote_directory.js +156 -0
- package/src/internal/origin_directory_converter.js +62 -0
- package/src/internal/response_validation.js +11 -24
- package/src/internal/sourceMappingURLUtils.js +10 -0
- package/src/internal/url_conversion.js +1 -0
|
@@ -38,7 +38,9 @@ export const createCompiledFileService = ({
|
|
|
38
38
|
logger,
|
|
39
39
|
|
|
40
40
|
projectDirectoryUrl,
|
|
41
|
+
jsenvDirectoryRelativeUrl,
|
|
41
42
|
outDirectoryRelativeUrl,
|
|
43
|
+
jsenvRemoteDirectory,
|
|
42
44
|
|
|
43
45
|
runtimeSupport,
|
|
44
46
|
babelPluginMap,
|
|
@@ -89,12 +91,9 @@ export const createCompiledFileService = ({
|
|
|
89
91
|
|
|
90
92
|
const importmapInfos = {}
|
|
91
93
|
|
|
92
|
-
return (request, { pushResponse, redirectRequest }) => {
|
|
94
|
+
return async (request, { pushResponse, redirectRequest }) => {
|
|
93
95
|
const { origin, ressource } = request
|
|
94
|
-
|
|
95
|
-
// Without this a pattern like "**/*.js" would not match "file.js?t=1"
|
|
96
|
-
// This would result in file not being compiled when they should
|
|
97
|
-
const requestUrl = `${origin}${ressourceToPathname(ressource)}`
|
|
96
|
+
const requestUrl = `${origin}${ressource}`
|
|
98
97
|
|
|
99
98
|
const requestCompileInfo = serverUrlToCompileInfo(requestUrl, {
|
|
100
99
|
outDirectoryRelativeUrl,
|
|
@@ -140,8 +139,6 @@ export const createCompiledFileService = ({
|
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
const originalFileRelativeUrl = afterCompileId
|
|
143
|
-
projectFileRequestedCallback(originalFileRelativeUrl, request)
|
|
144
|
-
|
|
145
142
|
const originalFileUrl = `${projectDirectoryUrl}${originalFileRelativeUrl}`
|
|
146
143
|
const compileDirectoryRelativeUrl = `${outDirectoryRelativeUrl}${compileId}/`
|
|
147
144
|
const compileDirectoryUrl = resolveDirectoryUrl(
|
|
@@ -152,23 +149,22 @@ export const createCompiledFileService = ({
|
|
|
152
149
|
originalFileRelativeUrl,
|
|
153
150
|
compileDirectoryUrl,
|
|
154
151
|
)
|
|
155
|
-
|
|
156
152
|
const compiler = getCompiler({ originalFileUrl, compileMeta })
|
|
157
153
|
// no compiler -> serve original file
|
|
158
|
-
// we
|
|
159
|
-
// and url resolution
|
|
154
|
+
// we redirect "internally" (we dont send 304 to the browser)
|
|
155
|
+
// to keep ressource tracking and url resolution simple
|
|
160
156
|
if (!compiler) {
|
|
161
157
|
return redirectRequest({
|
|
162
158
|
pathname: `/${originalFileRelativeUrl}`,
|
|
163
159
|
})
|
|
164
160
|
}
|
|
165
|
-
|
|
166
161
|
// compile this if needed
|
|
167
162
|
const compileResponsePromise = compileFile({
|
|
168
163
|
compileServerOperation,
|
|
169
164
|
logger,
|
|
170
165
|
|
|
171
166
|
projectDirectoryUrl,
|
|
167
|
+
jsenvRemoteDirectory,
|
|
172
168
|
originalFileUrl,
|
|
173
169
|
compiledFileUrl,
|
|
174
170
|
|
|
@@ -181,14 +177,16 @@ export const createCompiledFileService = ({
|
|
|
181
177
|
return compiler({
|
|
182
178
|
logger,
|
|
183
179
|
|
|
184
|
-
code,
|
|
185
|
-
url: originalFileUrl,
|
|
186
|
-
compiledUrl: compiledFileUrl,
|
|
187
180
|
projectDirectoryUrl,
|
|
181
|
+
jsenvRemoteDirectory,
|
|
188
182
|
compileServerOrigin: request.origin,
|
|
183
|
+
jsenvDirectoryRelativeUrl,
|
|
189
184
|
outDirectoryRelativeUrl,
|
|
190
|
-
|
|
185
|
+
url: originalFileUrl,
|
|
186
|
+
compiledUrl: compiledFileUrl,
|
|
191
187
|
request,
|
|
188
|
+
|
|
189
|
+
compileId,
|
|
192
190
|
babelPluginMap: shakeBabelPluginMap({
|
|
193
191
|
babelPluginMap,
|
|
194
192
|
missingFeatureNames: groupMap[compileId].missingFeatureNames,
|
|
@@ -204,6 +202,7 @@ export const createCompiledFileService = ({
|
|
|
204
202
|
topLevelAwait,
|
|
205
203
|
prependSystemJs,
|
|
206
204
|
|
|
205
|
+
code,
|
|
207
206
|
sourcemapMethod,
|
|
208
207
|
sourcemapExcludeSources,
|
|
209
208
|
jsenvEventSourceClientInjection,
|
|
@@ -238,6 +237,14 @@ const canAvoidSystemJs = ({
|
|
|
238
237
|
}
|
|
239
238
|
|
|
240
239
|
const getCompiler = ({ originalFileUrl, compileMeta }) => {
|
|
240
|
+
// we remove eventual query param from the url
|
|
241
|
+
// Without this a pattern like "**/*.js" would not match "file.js?t=1"
|
|
242
|
+
// This would result in file not being compiled when they should
|
|
243
|
+
// Ideally we would do a first pass with the query param and a second without
|
|
244
|
+
const urlObject = new URL(originalFileUrl)
|
|
245
|
+
urlObject.search = ""
|
|
246
|
+
originalFileUrl = urlObject.href
|
|
247
|
+
|
|
241
248
|
const { jsenvCompiler, customCompiler } = urlToMeta({
|
|
242
249
|
url: originalFileUrl,
|
|
243
250
|
structuredMetaMap: compileMeta,
|
|
@@ -307,12 +314,3 @@ const contentTypeExtensions = {
|
|
|
307
314
|
"application/importmap+json": ".importmap",
|
|
308
315
|
// "text/css": ".css",
|
|
309
316
|
}
|
|
310
|
-
|
|
311
|
-
const ressourceToPathname = (ressource) => {
|
|
312
|
-
const searchSeparatorIndex = ressource.indexOf("?")
|
|
313
|
-
const pathname =
|
|
314
|
-
searchSeparatorIndex === -1
|
|
315
|
-
? ressource
|
|
316
|
-
: ressource.slice(0, searchSeparatorIndex)
|
|
317
|
-
return pathname
|
|
318
|
-
}
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
removeHtmlNodeAttribute,
|
|
42
42
|
getHtmlNodeTextNode,
|
|
43
43
|
setHtmlNodeText,
|
|
44
|
-
|
|
44
|
+
getIdForInlineHtmlNode,
|
|
45
45
|
} from "./compileHtml.js"
|
|
46
46
|
import { jsenvCoreDirectoryUrl } from "../jsenvCoreDirectoryUrl.js"
|
|
47
47
|
|
|
@@ -121,8 +121,8 @@ export const createTransformHtmlSourceFileService = ({
|
|
|
121
121
|
jsenvScriptInjection,
|
|
122
122
|
jsenvEventSourceClientInjection,
|
|
123
123
|
jsenvToolbarInjection,
|
|
124
|
-
onInlineModuleScript: ({ scriptContent,
|
|
125
|
-
const inlineScriptUrl = resolveUrl(
|
|
124
|
+
onInlineModuleScript: ({ scriptContent, scriptSpecifier }) => {
|
|
125
|
+
const inlineScriptUrl = resolveUrl(scriptSpecifier, fileUrl)
|
|
126
126
|
htmlInlineScriptMap.set(inlineScriptUrl, {
|
|
127
127
|
htmlFileUrl: fileUrl,
|
|
128
128
|
scriptContent,
|
|
@@ -232,35 +232,35 @@ const transformHTMLSourceFile = async ({
|
|
|
232
232
|
const { scripts } = parseHtmlAstRessources(htmlAst)
|
|
233
233
|
scripts.forEach((script) => {
|
|
234
234
|
const typeAttribute = getHtmlNodeAttributeByName(script, "type")
|
|
235
|
+
const type = typeAttribute ? typeAttribute.value : ""
|
|
235
236
|
const srcAttribute = getHtmlNodeAttributeByName(script, "src")
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (typeAttribute && typeAttribute.value === "module" && srcAttribute) {
|
|
237
|
+
const src = srcAttribute ? srcAttribute.value : ""
|
|
238
|
+
if (type === "module" && src) {
|
|
239
239
|
removeHtmlNodeAttribute(script, srcAttribute)
|
|
240
|
+
// Ideally jsenv should take into account eventual
|
|
241
|
+
// "integrity" and "crossorigin" attribute during "executeFileUsingDynamicImport"
|
|
240
242
|
setHtmlNodeText(
|
|
241
243
|
script,
|
|
242
244
|
`window.__jsenv__.executeFileUsingDynamicImport(${JSON.stringify(
|
|
243
|
-
|
|
245
|
+
src,
|
|
244
246
|
)})`,
|
|
245
247
|
)
|
|
246
248
|
return
|
|
247
249
|
}
|
|
248
|
-
// inline
|
|
249
250
|
const textNode = getHtmlNodeTextNode(script)
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
251
|
+
if (type === "module" && textNode) {
|
|
252
|
+
const scriptId = getIdForInlineHtmlNode(script, scripts)
|
|
253
|
+
const scriptSpecifier = `${urlToFilename(
|
|
254
|
+
fileUrl,
|
|
255
|
+
)}__inline__${scriptId}.js`
|
|
256
256
|
onInlineModuleScript({
|
|
257
257
|
scriptContent: textNode.value,
|
|
258
|
-
|
|
258
|
+
scriptSpecifier,
|
|
259
259
|
})
|
|
260
260
|
setHtmlNodeText(
|
|
261
261
|
script,
|
|
262
262
|
`window.__jsenv__.executeFileUsingDynamicImport(${JSON.stringify(
|
|
263
|
-
`./${
|
|
263
|
+
`./${scriptSpecifier}`,
|
|
264
264
|
)})`,
|
|
265
265
|
)
|
|
266
266
|
return
|
|
@@ -275,7 +275,8 @@ const transformHTMLSourceFile = async ({
|
|
|
275
275
|
projectDirectoryUrl,
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
const htmlTransformed = stringifyHtmlAst(htmlAst)
|
|
279
|
+
return htmlTransformed
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
const visitImportmapScripts = async ({
|
|
@@ -315,14 +316,12 @@ const visitImportmapScripts = async ({
|
|
|
315
316
|
)
|
|
316
317
|
return
|
|
317
318
|
}
|
|
318
|
-
|
|
319
319
|
const importMapContent = await importMapResponse.json()
|
|
320
320
|
const importMapInlined = moveImportMap(
|
|
321
321
|
importMapContent,
|
|
322
322
|
importMapUrl,
|
|
323
323
|
htmlFileUrl,
|
|
324
324
|
)
|
|
325
|
-
|
|
326
325
|
replaceHtmlNode(
|
|
327
326
|
importmapScript,
|
|
328
327
|
`<script type="importmap">${JSON.stringify(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-core/src/tools/build-external-helpers.js
|
|
2
2
|
// the list of possible helpers:
|
|
3
3
|
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-helpers/src/helpers.js#L13
|
|
4
|
-
import { fileSystemPathToUrl } from "@jsenv/filesystem"
|
|
5
4
|
import { require } from "../../require.js"
|
|
6
5
|
|
|
7
6
|
const babelHelperNameInsideJsenvCoreArray = [
|
|
@@ -113,13 +112,14 @@ export const babelHelperNameToImportSpecifier = (babelHelperName) => {
|
|
|
113
112
|
return `${babelHelperAbstractScope}${babelHelperName}/${babelHelperName}.js`
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
export const
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
export const babelHelperNameFromUrl = (url) => {
|
|
116
|
+
if (!url.startsWith("file://")) {
|
|
117
|
+
return null
|
|
118
|
+
}
|
|
119
119
|
const babelHelperPrefix = "core/helpers/babel/"
|
|
120
|
-
if (
|
|
121
|
-
const afterBabelHelper =
|
|
122
|
-
|
|
120
|
+
if (url.includes(babelHelperPrefix)) {
|
|
121
|
+
const afterBabelHelper = url.slice(
|
|
122
|
+
url.indexOf(babelHelperPrefix) + babelHelperPrefix.length,
|
|
123
123
|
)
|
|
124
124
|
const babelHelperName = afterBabelHelper.slice(
|
|
125
125
|
0,
|
|
@@ -127,11 +127,9 @@ export const filePathToBabelHelperName = (filePath) => {
|
|
|
127
127
|
)
|
|
128
128
|
return babelHelperName
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
fileUrl.indexOf(babelHelperAbstractScope) +
|
|
134
|
-
babelHelperAbstractScope.length,
|
|
130
|
+
if (url.includes(babelHelperAbstractScope)) {
|
|
131
|
+
const afterBabelHelper = url.slice(
|
|
132
|
+
url.indexOf(babelHelperAbstractScope) + babelHelperAbstractScope.length,
|
|
135
133
|
)
|
|
136
134
|
const babelHelperName = afterBabelHelper.slice(
|
|
137
135
|
0,
|
|
@@ -139,7 +137,6 @@ export const filePathToBabelHelperName = (filePath) => {
|
|
|
139
137
|
)
|
|
140
138
|
return babelHelperName
|
|
141
139
|
}
|
|
142
|
-
|
|
143
140
|
return null
|
|
144
141
|
}
|
|
145
142
|
|
package/src/internal/compiling/js-compilation-service/babel_plugin_babel_helpers_as_jsenv_imports.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { fileSystemPathToUrl } from "@jsenv/filesystem"
|
|
2
|
+
|
|
1
3
|
import { require } from "../../require.js"
|
|
2
4
|
import {
|
|
3
|
-
|
|
5
|
+
babelHelperNameFromUrl,
|
|
4
6
|
babelHelperNameToImportSpecifier,
|
|
5
7
|
} from "./babelHelper.js"
|
|
6
8
|
|
|
@@ -37,7 +39,7 @@ export const babelPluginBabelHelpersAsJsenvImports = (api) => {
|
|
|
37
39
|
const babelHelperImportSpecifier =
|
|
38
40
|
babelHelperNameToImportSpecifier(name)
|
|
39
41
|
|
|
40
|
-
if (
|
|
42
|
+
if (babelHelperNameFromUrl(fileSystemPathToUrl(filePath)) === name) {
|
|
41
43
|
return undefined
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -6,18 +6,17 @@ import {
|
|
|
6
6
|
getMinimalBabelPluginMap,
|
|
7
7
|
babelPluginsFromBabelPluginMap,
|
|
8
8
|
} from "@jsenv/core/src/internal/compiling/babel_plugins.js"
|
|
9
|
+
import { babelPluginProxyExternalImports } from "@jsenv/core/src/internal/compiling/babel_plugin_proxy_external_imports.js"
|
|
9
10
|
import { babelPluginImportMetadata } from "@jsenv/core/src/internal/compiling/babel_plugin_import_metadata.js"
|
|
10
11
|
|
|
11
12
|
import { ansiToHTML } from "./ansiToHTML.js"
|
|
12
13
|
import { babelPluginRegeneratorRuntimeAsJsenvImport } from "./babel_plugin_regenerator_runtime_as_jsenv_import.js"
|
|
13
14
|
import { babelPluginBabelHelpersAsJsenvImports } from "./babel_plugin_babel_helpers_as_jsenv_imports.js"
|
|
14
15
|
import { babelPluginSystemJsPrepend } from "./babel_plugin_systemjs_prepend.js"
|
|
15
|
-
import {
|
|
16
|
+
import { babelHelperNameFromUrl } from "./babelHelper.js"
|
|
16
17
|
|
|
17
18
|
export const jsenvTransform = async ({
|
|
18
|
-
|
|
19
|
-
map, // optional
|
|
20
|
-
ast, // optional
|
|
19
|
+
jsenvRemoteDirectory,
|
|
21
20
|
url,
|
|
22
21
|
relativeUrl, // optional
|
|
23
22
|
|
|
@@ -25,16 +24,18 @@ export const jsenvTransform = async ({
|
|
|
25
24
|
moduleOutFormat,
|
|
26
25
|
importMetaFormat = moduleOutFormat,
|
|
27
26
|
topLevelAwait,
|
|
28
|
-
|
|
29
27
|
babelHelpersInjectionAsImport,
|
|
30
28
|
prependSystemJs,
|
|
31
29
|
transformGenerator,
|
|
32
30
|
regeneratorRuntimeImportPath,
|
|
31
|
+
|
|
33
32
|
sourcemapEnabled,
|
|
33
|
+
ast, // optional
|
|
34
|
+
map, // optional
|
|
35
|
+
code,
|
|
34
36
|
}) => {
|
|
35
37
|
const transformModulesSystemJs = require("@babel/plugin-transform-modules-systemjs")
|
|
36
38
|
const proposalDynamicImport = require("@babel/plugin-proposal-dynamic-import")
|
|
37
|
-
|
|
38
39
|
const inputPath = computeInputPath(url)
|
|
39
40
|
|
|
40
41
|
// https://babeljs.io/docs/en/options
|
|
@@ -60,7 +61,7 @@ export const jsenvTransform = async ({
|
|
|
60
61
|
},
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
const babelHelperName =
|
|
64
|
+
const babelHelperName = babelHelperNameFromUrl(url)
|
|
64
65
|
// to prevent typeof circular dependency
|
|
65
66
|
if (babelHelperName === "typeof") {
|
|
66
67
|
const babelPluginMapWithoutTransformTypeOf = { ...babelPluginMap }
|
|
@@ -146,6 +147,14 @@ export const jsenvTransform = async ({
|
|
|
146
147
|
],
|
|
147
148
|
}
|
|
148
149
|
: {}),
|
|
150
|
+
...(jsenvRemoteDirectory
|
|
151
|
+
? {
|
|
152
|
+
"proxy-external-imports": [
|
|
153
|
+
babelPluginProxyExternalImports,
|
|
154
|
+
{ jsenvRemoteDirectory },
|
|
155
|
+
],
|
|
156
|
+
}
|
|
157
|
+
: {}),
|
|
149
158
|
"import-metadata": [babelPluginImportMetadata],
|
|
150
159
|
}
|
|
151
160
|
if (moduleOutFormat === "systemjs") {
|
|
@@ -3,10 +3,9 @@ import { urlToRelativeUrl } from "@jsenv/filesystem"
|
|
|
3
3
|
import { jsenvTransform } from "./jsenvTransform.js"
|
|
4
4
|
|
|
5
5
|
export const transformJs = async ({
|
|
6
|
-
code,
|
|
7
|
-
map,
|
|
8
|
-
url,
|
|
9
6
|
projectDirectoryUrl,
|
|
7
|
+
jsenvRemoteDirectory,
|
|
8
|
+
url,
|
|
10
9
|
|
|
11
10
|
babelPluginMap,
|
|
12
11
|
moduleOutFormat = "esmodule",
|
|
@@ -16,6 +15,9 @@ export const transformJs = async ({
|
|
|
16
15
|
topLevelAwait,
|
|
17
16
|
transformGenerator = true,
|
|
18
17
|
sourcemapEnabled = true,
|
|
18
|
+
|
|
19
|
+
map,
|
|
20
|
+
code,
|
|
19
21
|
}) => {
|
|
20
22
|
if (typeof projectDirectoryUrl !== "string") {
|
|
21
23
|
throw new TypeError(
|
|
@@ -40,12 +42,14 @@ export const transformJs = async ({
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
const transformResult = await jsenvTransform({
|
|
43
|
-
code,
|
|
44
|
-
map,
|
|
45
45
|
url,
|
|
46
46
|
relativeUrl: url.startsWith(projectDirectoryUrl)
|
|
47
47
|
? urlToRelativeUrl(url, projectDirectoryUrl)
|
|
48
48
|
: undefined,
|
|
49
|
+
projectDirectoryUrl,
|
|
50
|
+
jsenvRemoteDirectory,
|
|
51
|
+
code,
|
|
52
|
+
map,
|
|
49
53
|
|
|
50
54
|
babelPluginMap,
|
|
51
55
|
moduleOutFormat,
|