@jsenv/core 19.7.2 → 20.0.2
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/.DS_Store +0 -0
- package/dist/jsenv_compile_proxy.js +4 -11
- package/dist/jsenv_compile_proxy.js.map +5 -6
- package/dist/jsenv_exploring_redirector.js +4 -11
- package/dist/jsenv_exploring_redirector.js.map +5 -6
- package/dist/jsenv_toolbar.js +4 -11
- package/dist/jsenv_toolbar.js.map +5 -6
- package/{LICENSE → license} +0 -0
- package/main.js +0 -6
- package/package.json +3 -5
- package/src/buildProject.js +50 -49
- package/src/execute.js +4 -2
- package/src/executeTestPlan.js +4 -2
- package/src/internal/CONSTANTS.js +4 -4
- package/src/internal/building/buildUsingRollup.js +44 -36
- package/src/internal/building/createJsenvRollupPlugin.js +9 -9
- package/src/internal/building/css/postcss-urlhash-plugin.js +0 -8
- package/src/internal/building/html/parseHtmlAsset.js +13 -2
- package/src/internal/compiling/compileHtml.js +6 -2
- package/src/internal/compiling/startCompileServer.js +3 -13
- package/src/internal/executing/executePlan.js +3 -2
- package/src/internal/generateGroupMap/generateGroupMap.js +18 -75
- package/src/{jsenvBabelPluginCompatMap.js → internal/generateGroupMap/jsenvBabelPluginCompatMap.js} +2 -1
- package/src/{jsenvPluginCompatMap.js → internal/generateGroupMap/jsenvPluginCompatMap.js} +0 -0
- package/src/internal/generateGroupMap/jsenvRuntimeSupport.js +15 -0
- package/src/internal/generateGroupMap/one_runtime_compat.js +70 -0
- package/src/internal/generateGroupMap/runtime_compat.js +46 -0
- package/src/internal/generateGroupMap/runtime_compat_composition.js +86 -0
- package/src/internal/runtime/createNodeRuntime/createNodeRuntime.js +4 -0
- package/src/internal/runtime/resolveGroup.js +3 -3
- package/src/internal/semantic-versioning/index.js +2 -0
- package/src/internal/semantic-versioning/valueToVersion.js +1 -6
- package/src/jsenvRuntimeSupportDuringDev.js +12 -0
- package/src/launchBrowser.js +8 -3
- package/src/playwright_browser_versions.js +5 -0
- package/src/startExploring.js +4 -4
- package/src/convertCommonJsWithBabel.js +0 -72
- package/src/getBabelPluginMapForNode.js +0 -18
- package/src/internal/generateGroupMap/composeGroup.js +0 -54
- package/src/internal/generateGroupMap/composeGroupArray.js +0 -43
- package/src/internal/generateGroupMap/composeRuntimeCompatMap.js +0 -37
- package/src/internal/generateGroupMap/computeBabelPluginMapForRuntime.js +0 -64
- package/src/internal/generateGroupMap/computeJsenvPluginMapForRuntime.js +0 -62
- package/src/internal/generateGroupMap/generateAllRuntimeGroupArray.js +0 -22
- package/src/internal/generateGroupMap/generateRuntimeGroupArray.js +0 -91
- package/src/internal/generateGroupMap/groupHaveSameRequirements.js +0 -8
- package/src/internal/generateGroupMap/runtimeCompatMapToScore.js +0 -39
- package/src/jsenvBrowserScoreMap.js +0 -27
- package/src/jsenvNodeVersionScoreMap.js +0 -12
package/src/buildProject.js
CHANGED
|
@@ -6,13 +6,17 @@ import {
|
|
|
6
6
|
import { resolveDirectoryUrl } from "@jsenv/filesystem"
|
|
7
7
|
|
|
8
8
|
import { executeJsenvAsyncFunction } from "./internal/executeJsenvAsyncFunction.js"
|
|
9
|
-
import {
|
|
9
|
+
import { COMPILE_ID_BEST } from "./internal/CONSTANTS.js"
|
|
10
10
|
import {
|
|
11
11
|
assertProjectDirectoryUrl,
|
|
12
12
|
assertProjectDirectoryExists,
|
|
13
13
|
} from "./internal/argUtils.js"
|
|
14
14
|
import { startCompileServer } from "./internal/compiling/startCompileServer.js"
|
|
15
15
|
import { buildUsingRollup } from "./internal/building/buildUsingRollup.js"
|
|
16
|
+
import {
|
|
17
|
+
jsenvBrowserRuntimeSupport,
|
|
18
|
+
jsenvNodeRuntimeSupport,
|
|
19
|
+
} from "./internal/generateGroupMap/jsenvRuntimeSupport.js"
|
|
16
20
|
import { jsenvBabelPluginMap } from "./jsenvBabelPluginMap.js"
|
|
17
21
|
|
|
18
22
|
export const buildProject = async ({
|
|
@@ -23,19 +27,25 @@ export const buildProject = async ({
|
|
|
23
27
|
logger,
|
|
24
28
|
|
|
25
29
|
projectDirectoryUrl,
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
entryPointMap,
|
|
31
|
+
buildDirectoryRelativeUrl,
|
|
32
|
+
buildDirectoryClean = false,
|
|
33
|
+
assetManifestFile = false,
|
|
34
|
+
assetManifestFileRelativeUrl = "asset-manifest.json",
|
|
35
|
+
sourcemapExcludeSources = false,
|
|
36
|
+
writeOnFileSystem = true,
|
|
28
37
|
|
|
29
38
|
format,
|
|
30
|
-
|
|
31
|
-
browser = format === "global" ||
|
|
32
|
-
format === "systemjs" ||
|
|
33
|
-
format === "esmodule",
|
|
34
|
-
node = format === "commonjs",
|
|
35
|
-
entryPointMap,
|
|
36
39
|
systemJsUrl = "/node_modules/systemjs/dist/s.min.js",
|
|
37
40
|
globalName,
|
|
38
41
|
globals = {},
|
|
42
|
+
babelPluginMap = jsenvBabelPluginMap,
|
|
43
|
+
runtimeSupport = format === "global" ||
|
|
44
|
+
format === "systemjs" ||
|
|
45
|
+
format === "esmodule"
|
|
46
|
+
? jsenvBrowserRuntimeSupport
|
|
47
|
+
: jsenvNodeRuntimeSupport,
|
|
48
|
+
transformTopLevelAwait = true,
|
|
39
49
|
|
|
40
50
|
urlMappings = {},
|
|
41
51
|
importResolutionMethod = format === "commonjs" ? "node" : "importmap",
|
|
@@ -49,29 +59,14 @@ export const buildProject = async ({
|
|
|
49
59
|
: {},
|
|
50
60
|
importPaths = {},
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
compileServerProtocol,
|
|
55
|
-
compileServerPrivateKey,
|
|
56
|
-
compileServerCertificate,
|
|
57
|
-
compileServerIp,
|
|
58
|
-
compileServerPort,
|
|
59
|
-
babelPluginMap = jsenvBabelPluginMap,
|
|
60
|
-
transformTopLevelAwait = true,
|
|
61
|
-
|
|
62
|
-
sourcemapExcludeSources = false,
|
|
63
|
-
|
|
64
|
-
buildDirectoryRelativeUrl,
|
|
65
|
-
buildDirectoryClean = false,
|
|
66
|
-
writeOnFileSystem = true,
|
|
67
|
-
assetManifestFile = false,
|
|
68
|
-
assetManifestFileRelativeUrl = "asset-manifest.json",
|
|
69
|
-
|
|
70
|
-
preserveEntrySignatures,
|
|
62
|
+
urlVersioning = true,
|
|
63
|
+
lineBreakNormalization = process.platform === "win32",
|
|
71
64
|
// when jsConcatenation is disabled rollup becomes almost useless
|
|
72
|
-
// except it can still do tree shaking
|
|
73
|
-
// fails to catch many things so...
|
|
65
|
+
// except it can still do tree shaking
|
|
74
66
|
jsConcatenation = true,
|
|
67
|
+
useImportMapToImproveLongTermCaching = format === "systemjs",
|
|
68
|
+
preserveEntrySignatures,
|
|
69
|
+
|
|
75
70
|
minify = process.env.NODE_ENV === "production",
|
|
76
71
|
// https://github.com/kangax/html-minifier#options-quick-reference
|
|
77
72
|
minifyHtmlOptions = { collapseWhitespace: true },
|
|
@@ -80,9 +75,17 @@ export const buildProject = async ({
|
|
|
80
75
|
// https://github.com/cssnano/cssnano/tree/master/packages/cssnano-preset-default
|
|
81
76
|
minifyCssOptions,
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
serviceWorkers = {},
|
|
79
|
+
serviceWorkerFinalizer,
|
|
80
|
+
|
|
81
|
+
env = {},
|
|
82
|
+
compileServerProtocol,
|
|
83
|
+
compileServerPrivateKey,
|
|
84
|
+
compileServerCertificate,
|
|
85
|
+
compileServerIp,
|
|
86
|
+
compileServerPort,
|
|
87
|
+
jsenvDirectoryRelativeUrl,
|
|
88
|
+
jsenvDirectoryClean,
|
|
86
89
|
|
|
87
90
|
// when true .jsenv/out-build directory is generated
|
|
88
91
|
// with all intermediated files used to produce the final build files.
|
|
@@ -95,9 +98,6 @@ export const buildProject = async ({
|
|
|
95
98
|
// (to fix that sourcemap could be inlined)
|
|
96
99
|
filesystemCache = true,
|
|
97
100
|
|
|
98
|
-
serviceWorkers = {},
|
|
99
|
-
serviceWorkerFinalizer,
|
|
100
|
-
|
|
101
101
|
...rest
|
|
102
102
|
}) => {
|
|
103
103
|
const jsenvBuildFunction = async ({ jsenvCancellationToken }) => {
|
|
@@ -167,6 +167,8 @@ export const buildProject = async ({
|
|
|
167
167
|
// nor to inject jsenv script
|
|
168
168
|
transformHtmlSourceFiles: false,
|
|
169
169
|
|
|
170
|
+
runtimeSupport,
|
|
171
|
+
|
|
170
172
|
// override with potential custom options
|
|
171
173
|
...rest,
|
|
172
174
|
})
|
|
@@ -182,7 +184,11 @@ export const buildProject = async ({
|
|
|
182
184
|
entryPointMap,
|
|
183
185
|
projectDirectoryUrl,
|
|
184
186
|
compileServerOrigin,
|
|
185
|
-
compileDirectoryRelativeUrl: `${outDirectoryRelativeUrl}${
|
|
187
|
+
compileDirectoryRelativeUrl: `${outDirectoryRelativeUrl}${COMPILE_ID_BEST}/`,
|
|
188
|
+
buildDirectoryUrl,
|
|
189
|
+
buildDirectoryClean,
|
|
190
|
+
assetManifestFile,
|
|
191
|
+
assetManifestFileRelativeUrl,
|
|
186
192
|
|
|
187
193
|
urlMappings,
|
|
188
194
|
importResolutionMethod,
|
|
@@ -192,28 +198,20 @@ export const buildProject = async ({
|
|
|
192
198
|
externalImportUrlPatterns,
|
|
193
199
|
importPaths,
|
|
194
200
|
|
|
195
|
-
babelPluginMap,
|
|
196
|
-
transformTopLevelAwait,
|
|
197
|
-
node,
|
|
198
|
-
browser,
|
|
199
|
-
writeOnFileSystem,
|
|
200
|
-
|
|
201
201
|
format,
|
|
202
202
|
systemJsUrl,
|
|
203
203
|
globalName,
|
|
204
204
|
globals,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
buildDirectoryClean,
|
|
209
|
-
assetManifestFile,
|
|
210
|
-
assetManifestFileRelativeUrl,
|
|
205
|
+
babelPluginMap,
|
|
206
|
+
transformTopLevelAwait,
|
|
207
|
+
runtimeSupport,
|
|
211
208
|
|
|
212
209
|
urlVersioning,
|
|
213
210
|
lineBreakNormalization,
|
|
214
211
|
useImportMapToImproveLongTermCaching,
|
|
215
212
|
preserveEntrySignatures,
|
|
216
213
|
jsConcatenation,
|
|
214
|
+
|
|
217
215
|
minify,
|
|
218
216
|
minifyHtmlOptions,
|
|
219
217
|
minifyJsOptions,
|
|
@@ -221,6 +219,9 @@ export const buildProject = async ({
|
|
|
221
219
|
|
|
222
220
|
serviceWorkers,
|
|
223
221
|
serviceWorkerFinalizer,
|
|
222
|
+
|
|
223
|
+
writeOnFileSystem,
|
|
224
|
+
sourcemapExcludeSources,
|
|
224
225
|
})
|
|
225
226
|
|
|
226
227
|
return result
|
package/src/execute.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "./internal/argUtils.js"
|
|
11
11
|
import { startCompileServer } from "./internal/compiling/startCompileServer.js"
|
|
12
12
|
import { launchAndExecute } from "./internal/executing/launchAndExecute.js"
|
|
13
|
+
import { jsenvRuntimeSupportDuringDev } from "./jsenvRuntimeSupportDuringDev.js"
|
|
13
14
|
|
|
14
15
|
export const execute = async ({
|
|
15
16
|
logLevel = "warn",
|
|
@@ -50,9 +51,9 @@ export const execute = async ({
|
|
|
50
51
|
compileServerPort,
|
|
51
52
|
babelPluginMap,
|
|
52
53
|
convertMap,
|
|
53
|
-
compileGroupCount = 2,
|
|
54
54
|
compileServerCanReadFromFilesystem,
|
|
55
55
|
compileServerCanWriteOnFilesystem,
|
|
56
|
+
runtimeSupportDuringDev = jsenvRuntimeSupportDuringDev,
|
|
56
57
|
}) => {
|
|
57
58
|
const jsenvExecutionFunction = async ({ jsenvCancellationToken }) => {
|
|
58
59
|
cancellationToken = composeCancellationToken(
|
|
@@ -84,6 +85,7 @@ export const execute = async ({
|
|
|
84
85
|
projectDirectoryUrl,
|
|
85
86
|
jsenvDirectoryRelativeUrl,
|
|
86
87
|
jsenvDirectoryClean,
|
|
88
|
+
outDirectoryName: "out-dev",
|
|
87
89
|
|
|
88
90
|
importDefaultExtension,
|
|
89
91
|
|
|
@@ -94,7 +96,7 @@ export const execute = async ({
|
|
|
94
96
|
compileServerPort,
|
|
95
97
|
babelPluginMap,
|
|
96
98
|
convertMap,
|
|
97
|
-
|
|
99
|
+
runtimeSupport: runtimeSupportDuringDev,
|
|
98
100
|
compileServerCanReadFromFilesystem,
|
|
99
101
|
compileServerCanWriteOnFilesystem,
|
|
100
102
|
})
|
package/src/executeTestPlan.js
CHANGED
|
@@ -24,6 +24,7 @@ import { generateCoverageJsonFile } from "./internal/executing/coverage/generate
|
|
|
24
24
|
import { generateCoverageHtmlDirectory } from "./internal/executing/coverage/generateCoverageHtmlDirectory.js"
|
|
25
25
|
import { generateCoverageTextLog } from "./internal/executing/coverage/generateCoverageTextLog.js"
|
|
26
26
|
import { jsenvCoverageConfig } from "./jsenvCoverageConfig.js"
|
|
27
|
+
import { jsenvRuntimeSupportDuringDev } from "./jsenvRuntimeSupportDuringDev.js"
|
|
27
28
|
|
|
28
29
|
export const executeTestPlan = async ({
|
|
29
30
|
logLevel = "info",
|
|
@@ -77,7 +78,8 @@ export const executeTestPlan = async ({
|
|
|
77
78
|
compileServerCanWriteOnFilesystem,
|
|
78
79
|
babelPluginMap,
|
|
79
80
|
convertMap,
|
|
80
|
-
|
|
81
|
+
// we could even affine depending on testPlan
|
|
82
|
+
runtimeSupportDuringDev = jsenvRuntimeSupportDuringDev,
|
|
81
83
|
jsenvDirectoryClean,
|
|
82
84
|
}) => {
|
|
83
85
|
const jsenvExecuteTestPlanFunction = async ({ jsenvCancellationToken }) => {
|
|
@@ -184,7 +186,7 @@ export const executeTestPlan = async ({
|
|
|
184
186
|
compileServerCanWriteOnFilesystem,
|
|
185
187
|
babelPluginMap,
|
|
186
188
|
convertMap,
|
|
187
|
-
|
|
189
|
+
runtimeSupport: runtimeSupportDuringDev,
|
|
188
190
|
})
|
|
189
191
|
|
|
190
192
|
if (updateProcessExitCode && !executionIsPassed(result)) {
|
|
@@ -2,10 +2,10 @@ export const COMPILE_ID_BEST = "best"
|
|
|
2
2
|
|
|
3
3
|
export const COMPILE_ID_OTHERWISE = "otherwise"
|
|
4
4
|
|
|
5
|
-
export const COMPILE_ID_BUILD_GLOBAL = "
|
|
5
|
+
export const COMPILE_ID_BUILD_GLOBAL = "build-global"
|
|
6
6
|
|
|
7
|
-
export const COMPILE_ID_BUILD_GLOBAL_FILES = "
|
|
7
|
+
export const COMPILE_ID_BUILD_GLOBAL_FILES = "build-global-files"
|
|
8
8
|
|
|
9
|
-
export const COMPILE_ID_BUILD_COMMONJS = "
|
|
9
|
+
export const COMPILE_ID_BUILD_COMMONJS = "build-commonjs"
|
|
10
10
|
|
|
11
|
-
export const COMPILE_ID_BUILD_COMMONJS_FILES = "
|
|
11
|
+
export const COMPILE_ID_BUILD_COMMONJS_FILES = "build-commonjs-files"
|
|
@@ -8,10 +8,24 @@ export const buildUsingRollup = async ({
|
|
|
8
8
|
cancellationToken,
|
|
9
9
|
logger,
|
|
10
10
|
|
|
11
|
-
entryPointMap,
|
|
12
11
|
projectDirectoryUrl,
|
|
12
|
+
entryPointMap,
|
|
13
13
|
compileServerOrigin,
|
|
14
14
|
compileDirectoryRelativeUrl,
|
|
15
|
+
buildDirectoryUrl,
|
|
16
|
+
buildDirectoryClean,
|
|
17
|
+
assetManifestFile = false,
|
|
18
|
+
assetManifestFileRelativeUrl,
|
|
19
|
+
sourcemapExcludeSources,
|
|
20
|
+
writeOnFileSystem,
|
|
21
|
+
|
|
22
|
+
format,
|
|
23
|
+
systemJsUrl,
|
|
24
|
+
globalName,
|
|
25
|
+
globals,
|
|
26
|
+
babelPluginMap,
|
|
27
|
+
runtimeSupport,
|
|
28
|
+
transformTopLevelAwait,
|
|
15
29
|
|
|
16
30
|
urlMappings,
|
|
17
31
|
importResolutionMethod,
|
|
@@ -21,46 +35,52 @@ export const buildUsingRollup = async ({
|
|
|
21
35
|
externalImportUrlPatterns,
|
|
22
36
|
importPaths,
|
|
23
37
|
|
|
24
|
-
babelPluginMap,
|
|
25
|
-
transformTopLevelAwait,
|
|
26
|
-
node,
|
|
27
|
-
browser,
|
|
28
|
-
|
|
29
|
-
format,
|
|
30
|
-
systemJsUrl,
|
|
31
|
-
globals,
|
|
32
|
-
globalName,
|
|
33
|
-
sourcemapExcludeSources,
|
|
34
|
-
|
|
35
|
-
buildDirectoryUrl,
|
|
36
|
-
buildDirectoryClean,
|
|
37
|
-
|
|
38
38
|
urlVersioning,
|
|
39
|
+
lineBreakNormalization,
|
|
40
|
+
jsConcatenation,
|
|
39
41
|
useImportMapToImproveLongTermCaching,
|
|
40
42
|
preserveEntrySignatures,
|
|
41
|
-
|
|
43
|
+
|
|
42
44
|
minify,
|
|
43
45
|
minifyJsOptions,
|
|
44
46
|
minifyCssOptions,
|
|
45
47
|
minifyHtmlOptions,
|
|
46
|
-
assetManifestFile = false,
|
|
47
|
-
assetManifestFileRelativeUrl,
|
|
48
48
|
|
|
49
49
|
serviceWorkers,
|
|
50
50
|
serviceWorkerFinalizer,
|
|
51
|
-
|
|
52
|
-
lineBreakNormalization,
|
|
53
|
-
writeOnFileSystem,
|
|
54
51
|
}) => {
|
|
52
|
+
const node = Boolean(runtimeSupport.node)
|
|
53
|
+
const browser = Boolean(
|
|
54
|
+
runtimeSupport.android ||
|
|
55
|
+
runtimeSupport.chrome ||
|
|
56
|
+
runtimeSupport.edge ||
|
|
57
|
+
runtimeSupport.electron ||
|
|
58
|
+
runtimeSupport.firefox ||
|
|
59
|
+
runtimeSupport.ios ||
|
|
60
|
+
runtimeSupport.opera ||
|
|
61
|
+
runtimeSupport.safari,
|
|
62
|
+
)
|
|
63
|
+
|
|
55
64
|
const { jsenvRollupPlugin, getLastErrorMessage, getResult } =
|
|
56
65
|
await createJsenvRollupPlugin({
|
|
57
66
|
cancellationToken,
|
|
58
67
|
logger,
|
|
59
68
|
|
|
60
|
-
entryPointMap,
|
|
61
69
|
projectDirectoryUrl,
|
|
70
|
+
entryPointMap,
|
|
62
71
|
compileServerOrigin,
|
|
63
72
|
compileDirectoryRelativeUrl,
|
|
73
|
+
buildDirectoryUrl,
|
|
74
|
+
assetManifestFile,
|
|
75
|
+
assetManifestFileRelativeUrl,
|
|
76
|
+
writeOnFileSystem,
|
|
77
|
+
|
|
78
|
+
format,
|
|
79
|
+
systemJsUrl,
|
|
80
|
+
babelPluginMap,
|
|
81
|
+
transformTopLevelAwait,
|
|
82
|
+
node,
|
|
83
|
+
browser,
|
|
64
84
|
|
|
65
85
|
urlMappings,
|
|
66
86
|
importResolutionMethod,
|
|
@@ -70,27 +90,15 @@ export const buildUsingRollup = async ({
|
|
|
70
90
|
externalImportUrlPatterns,
|
|
71
91
|
importPaths,
|
|
72
92
|
|
|
73
|
-
babelPluginMap,
|
|
74
|
-
transformTopLevelAwait,
|
|
75
|
-
node,
|
|
76
|
-
browser,
|
|
77
|
-
|
|
78
|
-
format,
|
|
79
|
-
systemJsUrl,
|
|
80
|
-
buildDirectoryUrl,
|
|
81
|
-
|
|
82
|
-
jsConcatenation,
|
|
83
93
|
urlVersioning,
|
|
84
94
|
lineBreakNormalization,
|
|
95
|
+
jsConcatenation,
|
|
85
96
|
useImportMapToImproveLongTermCaching,
|
|
97
|
+
|
|
86
98
|
minify,
|
|
87
99
|
minifyJsOptions,
|
|
88
100
|
minifyCssOptions,
|
|
89
101
|
minifyHtmlOptions,
|
|
90
|
-
|
|
91
|
-
assetManifestFile,
|
|
92
|
-
assetManifestFileRelativeUrl,
|
|
93
|
-
writeOnFileSystem,
|
|
94
102
|
})
|
|
95
103
|
|
|
96
104
|
try {
|
|
@@ -51,10 +51,14 @@ export const createJsenvRollupPlugin = async ({
|
|
|
51
51
|
cancellationToken,
|
|
52
52
|
logger,
|
|
53
53
|
|
|
54
|
-
entryPointMap,
|
|
55
54
|
projectDirectoryUrl,
|
|
55
|
+
entryPointMap,
|
|
56
56
|
compileServerOrigin,
|
|
57
57
|
compileDirectoryRelativeUrl,
|
|
58
|
+
buildDirectoryUrl,
|
|
59
|
+
assetManifestFile,
|
|
60
|
+
assetManifestFileRelativeUrl,
|
|
61
|
+
writeOnFileSystem,
|
|
58
62
|
|
|
59
63
|
urlMappings,
|
|
60
64
|
importResolutionMethod,
|
|
@@ -64,25 +68,21 @@ export const createJsenvRollupPlugin = async ({
|
|
|
64
68
|
externalImportUrlPatterns,
|
|
65
69
|
importPaths,
|
|
66
70
|
|
|
71
|
+
format,
|
|
72
|
+
systemJsUrl,
|
|
67
73
|
babelPluginMap,
|
|
68
74
|
transformTopLevelAwait,
|
|
69
75
|
node,
|
|
70
76
|
|
|
71
|
-
format,
|
|
72
|
-
jsConcatenation,
|
|
73
77
|
urlVersioning,
|
|
74
78
|
lineBreakNormalization,
|
|
79
|
+
jsConcatenation,
|
|
75
80
|
useImportMapToImproveLongTermCaching,
|
|
76
|
-
|
|
81
|
+
|
|
77
82
|
minify,
|
|
78
83
|
minifyJsOptions,
|
|
79
84
|
minifyCssOptions,
|
|
80
85
|
minifyHtmlOptions,
|
|
81
|
-
assetManifestFile,
|
|
82
|
-
assetManifestFileRelativeUrl,
|
|
83
|
-
writeOnFileSystem,
|
|
84
|
-
|
|
85
|
-
buildDirectoryUrl,
|
|
86
86
|
}) => {
|
|
87
87
|
const urlImporterMap = {}
|
|
88
88
|
const urlResponseBodyMap = {}
|
|
@@ -126,10 +126,6 @@ export const postCssUrlHashPlugin = () => {
|
|
|
126
126
|
},
|
|
127
127
|
},
|
|
128
128
|
Declaration: (declarationNode) => {
|
|
129
|
-
if (!declarationNodeContainsUrl(declarationNode)) {
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
|
|
133
129
|
walkUrls(declarationNode, {
|
|
134
130
|
parseCssValue,
|
|
135
131
|
stringifyCssNodes,
|
|
@@ -176,10 +172,6 @@ export const postCssUrlHashPlugin = () => {
|
|
|
176
172
|
}
|
|
177
173
|
postCssUrlHashPlugin.postcss = true
|
|
178
174
|
|
|
179
|
-
const declarationNodeContainsUrl = (declarationNode) => {
|
|
180
|
-
return /^(?:url|(?:-webkit-)?image-set)\(/i.test(declarationNode.value)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
175
|
const walkUrls = (
|
|
184
176
|
declarationNode,
|
|
185
177
|
{ parseCssValue, stringifyCssNodes, visitor },
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
parseSrcset,
|
|
39
39
|
stringifySrcset,
|
|
40
40
|
} from "@jsenv/core/src/internal/compiling/compileHtml.js"
|
|
41
|
+
import { setJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
|
|
41
42
|
import {
|
|
42
43
|
getTargetAsBase64Url,
|
|
43
44
|
targetIsReferencedOnlyByRessourceHint,
|
|
@@ -258,8 +259,14 @@ const moduleScriptSrcVisitor = (script, { format, notifyReferenceFound }) => {
|
|
|
258
259
|
// here put a warning if we cannot inline importmap because it would mess
|
|
259
260
|
// the remapping (note that it's feasible) but not yet supported
|
|
260
261
|
removeHtmlNodeAttribute(script, srcAttribute)
|
|
261
|
-
const { targetBuildBuffer } =
|
|
262
|
-
|
|
262
|
+
const { targetBuildBuffer } = remoteScriptReference.target
|
|
263
|
+
const jsString = String(targetBuildBuffer)
|
|
264
|
+
|
|
265
|
+
const codeWithSourcemapComment = setJavaScriptSourceMappingUrl(
|
|
266
|
+
jsString,
|
|
267
|
+
`${remoteScriptReference.target.targetFileName}.map`
|
|
268
|
+
)
|
|
269
|
+
setHtmlNodeText(script, codeWithSourcemapComment)
|
|
263
270
|
return
|
|
264
271
|
}
|
|
265
272
|
|
|
@@ -669,6 +676,10 @@ const shouldInline = ({ reference, htmlNode }) => {
|
|
|
669
676
|
return true
|
|
670
677
|
}
|
|
671
678
|
|
|
679
|
+
return readAndRemoveForceInline(htmlNode)
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
const readAndRemoveForceInline = (htmlNode) => {
|
|
672
683
|
const jsenvForceInlineAttribute = getHtmlNodeAttributeByName(
|
|
673
684
|
htmlNode,
|
|
674
685
|
"data-jsenv-force-inline",
|
|
@@ -286,9 +286,13 @@ export const replaceHtmlNode = (
|
|
|
286
286
|
|
|
287
287
|
if (inheritAttributes) {
|
|
288
288
|
newNode.attrs = [
|
|
289
|
-
// inherit script attributes except src, type, href
|
|
289
|
+
// inherit script attributes except src, type, href, rel
|
|
290
290
|
...node.attrs.filter(
|
|
291
|
-
({ name }) =>
|
|
291
|
+
({ name }) =>
|
|
292
|
+
name !== "type" &&
|
|
293
|
+
name !== "src" &&
|
|
294
|
+
name !== "href" &&
|
|
295
|
+
name !== "rel",
|
|
292
296
|
),
|
|
293
297
|
...newNode.attrs,
|
|
294
298
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/max-dependencies */
|
|
2
|
-
import { readFileSync } from "fs"
|
|
2
|
+
import { readFileSync } from "node:fs"
|
|
3
3
|
import {
|
|
4
4
|
createCancellationToken,
|
|
5
5
|
createCancellationSource,
|
|
@@ -28,9 +28,6 @@ import {
|
|
|
28
28
|
urlToBasename,
|
|
29
29
|
} from "@jsenv/filesystem"
|
|
30
30
|
|
|
31
|
-
import { jsenvBabelPluginCompatMap } from "../../jsenvBabelPluginCompatMap.js"
|
|
32
|
-
import { jsenvBrowserScoreMap } from "../../jsenvBrowserScoreMap.js"
|
|
33
|
-
import { jsenvNodeVersionScoreMap } from "../../jsenvNodeVersionScoreMap.js"
|
|
34
31
|
import { jsenvBabelPluginMap } from "../../jsenvBabelPluginMap.js"
|
|
35
32
|
import { generateGroupMap } from "../generateGroupMap/generateGroupMap.js"
|
|
36
33
|
import { createCallbackList } from "../createCallbackList.js"
|
|
@@ -89,11 +86,7 @@ export const startCompileServer = async ({
|
|
|
89
86
|
stopOnPackageVersionChange = false,
|
|
90
87
|
|
|
91
88
|
// remaining options
|
|
92
|
-
|
|
93
|
-
babelCompatMap = jsenvBabelPluginCompatMap,
|
|
94
|
-
browserScoreMap = jsenvBrowserScoreMap,
|
|
95
|
-
nodeVersionScoreMap = jsenvNodeVersionScoreMap,
|
|
96
|
-
runtimeAlwaysInsideRuntimeScoreMap = false,
|
|
89
|
+
runtimeSupport,
|
|
97
90
|
|
|
98
91
|
livereloadWatchConfig = {
|
|
99
92
|
"./**": true,
|
|
@@ -136,10 +129,7 @@ export const startCompileServer = async ({
|
|
|
136
129
|
const logger = createLogger({ logLevel: compileServerLogLevel })
|
|
137
130
|
const compileServerGroupMap = generateGroupMap({
|
|
138
131
|
babelPluginMap,
|
|
139
|
-
|
|
140
|
-
runtimeScoreMap: { ...browserScoreMap, node: nodeVersionScoreMap },
|
|
141
|
-
groupCount: compileGroupCount,
|
|
142
|
-
runtimeAlwaysInsideRuntimeScoreMap,
|
|
132
|
+
runtimeSupport,
|
|
143
133
|
})
|
|
144
134
|
|
|
145
135
|
babelPluginMap = {
|
|
@@ -40,7 +40,7 @@ export const executePlan = async (
|
|
|
40
40
|
compileServerCanWriteOnFilesystem,
|
|
41
41
|
babelPluginMap,
|
|
42
42
|
convertMap,
|
|
43
|
-
|
|
43
|
+
runtimeSupport,
|
|
44
44
|
} = {},
|
|
45
45
|
) => {
|
|
46
46
|
if (coverage) {
|
|
@@ -64,6 +64,7 @@ export const executePlan = async (
|
|
|
64
64
|
projectDirectoryUrl,
|
|
65
65
|
jsenvDirectoryRelativeUrl,
|
|
66
66
|
jsenvDirectoryClean,
|
|
67
|
+
outDirectoryName: "out-dev",
|
|
67
68
|
|
|
68
69
|
importResolutionMethod,
|
|
69
70
|
importDefaultExtension,
|
|
@@ -78,7 +79,7 @@ export const executePlan = async (
|
|
|
78
79
|
keepProcessAlive: true, // to be sure it stays alive
|
|
79
80
|
babelPluginMap,
|
|
80
81
|
convertMap,
|
|
81
|
-
|
|
82
|
+
runtimeSupport,
|
|
82
83
|
})
|
|
83
84
|
|
|
84
85
|
const executionSteps = await generateExecutionSteps(
|