@jsenv/core 22.4.0 → 23.0.0
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/jsenv_browser_system.js +331 -256
- package/dist/jsenv_browser_system.js.map +55 -33
- package/dist/jsenv_compile_proxy.js +186 -108
- package/dist/jsenv_compile_proxy.js.map +48 -42
- package/dist/jsenv_exploring_redirector.js +148 -71
- package/dist/jsenv_exploring_redirector.js.map +26 -20
- package/dist/jsenv_toolbar.js +215 -104
- package/dist/jsenv_toolbar.js.map +39 -26
- package/helpers/new_stylesheet/new_stylesheet.js +411 -0
- package/{LICENSE → license} +0 -0
- package/main.js +8 -7
- package/package.json +23 -19
- package/readme.md +9 -6
- package/src/buildProject.js +3 -7
- package/src/execute.js +23 -10
- package/src/executeTestPlan.js +0 -4
- package/src/importUsingChildProcess.js +36 -32
- package/src/internal/{babel-plugin-replace-expressions.js → babel_plugin_replace_expressions.js} +0 -0
- package/src/internal/{babel-plugin-transform-import-meta.js → babel_plugin_transform_import_meta.js} +0 -0
- package/src/internal/browser-launcher/executeHtmlFile.js +6 -8
- package/src/internal/browser-launcher/jsenv-browser-system.js +3 -0
- package/src/internal/building/asset_url_versioning.js +5 -9
- package/src/internal/building/buildServiceWorker.js +6 -13
- package/src/internal/building/buildUsingRollup.js +41 -4
- package/src/internal/building/build_logs.js +11 -0
- package/src/internal/building/build_stats.js +7 -1
- package/src/internal/building/createJsenvRollupPlugin.js +402 -297
- package/src/internal/building/css/parseCssRessource.js +67 -71
- package/src/internal/building/css/parseCssUrls.js +2 -2
- package/src/internal/building/css/{postcss-urlhash-plugin.js → postcss_plugin_url_visitor.js} +43 -21
- package/src/internal/building/css/replaceCssUrls.js +17 -14
- package/src/internal/building/css_module.js +47 -0
- package/src/internal/building/html/parseHtmlRessource.js +44 -43
- package/src/internal/building/import_references.js +81 -0
- package/src/internal/building/importmap/parseImportmapRessource.js +5 -2
- package/src/internal/building/js/minifyJs.js +30 -3
- package/src/internal/building/js/parseJsRessource.js +70 -77
- package/src/internal/building/json/parseJsonRessource.js +3 -2
- package/src/internal/building/parseRessource.js +11 -8
- package/src/internal/building/parsing.utils.js +4 -15
- package/src/internal/building/ressource_builder.js +142 -114
- package/src/internal/building/ressource_builder_util.js +31 -18
- package/src/internal/building/{fetchSourcemap.js → sourcemap_loader.js} +29 -27
- package/src/internal/building/svg/parseSvgRessource.js +7 -3
- package/src/internal/building/url-versioning.js +2 -1
- package/src/internal/building/url_fetcher.js +79 -0
- package/src/internal/building/url_loader.js +267 -0
- package/src/internal/building/url_trace.js +1 -1
- package/src/internal/building/webmanifest/parseWebmanifestRessource.js +9 -4
- package/src/internal/compiling/{js-compilation-service/ensureGlobalThisImportBabelPlugin.js → babel_plugin_global_this_as_jsenv_import.js} +4 -2
- package/src/internal/compiling/babel_plugin_import_assertions.js +100 -0
- package/src/internal/compiling/babel_plugin_new_stylesheet_as_jsenv_import.js +109 -0
- package/src/internal/compiling/babel_plugin_transform_import_specifier.js +86 -0
- package/src/internal/compiling/babel_plugins.js +2 -0
- package/src/internal/compiling/createCompiledFileService.js +46 -15
- package/src/internal/compiling/html_source_file_service.js +2 -2
- package/src/internal/compiling/js-compilation-service/{transformBabelHelperToImportBabelPlugin.js → babel_plugin_babel_helpers_as_jsenv_imports.js} +1 -1
- package/src/internal/compiling/js-compilation-service/{ensureRegeneratorRuntimeImportBabelPlugin.js → babel_plugin_regenerator_runtime_as_jsenv_import.js} +1 -1
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +7 -16
- package/src/internal/compiling/js-compilation-service/transformJs.js +0 -2
- package/src/internal/compiling/jsenvCompilerForHtml.js +2 -7
- package/src/internal/compiling/rollup_plugin_commonjs_named_exports.js +2 -2
- package/src/internal/compiling/startCompileServer.js +11 -4
- package/src/internal/escapeTemplateStringSpecialCharacters.js +20 -0
- package/src/internal/executing/coverage/{babel-plugin-instrument.js → babel_plugin_instrument.js} +17 -6
- package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +1 -1
- package/src/internal/executing/executeConcurrently.js +5 -3
- package/src/internal/executing/executePlan.js +16 -2
- package/src/internal/executing/generateFileExecutionSteps.js +2 -1
- package/src/internal/executing/launchAndExecute.js +43 -69
- package/src/internal/executing/writeLog.js +25 -18
- package/src/internal/exploring/exploring.css +2 -1
- package/src/internal/exploring/exploring.redirector.js +0 -1
- package/src/internal/generateGroupMap/generateGroupMap.js +14 -10
- package/src/internal/generateGroupMap/jsenvBabelPluginCompatMap.js +30 -0
- package/src/internal/generateGroupMap/jsenvPluginCompatMap.js +0 -6
- package/src/internal/generateGroupMap/one_runtime_compat.js +9 -38
- package/src/internal/generateGroupMap/runtime_compat.js +9 -24
- package/src/internal/generateGroupMap/runtime_compat_composition.js +2 -12
- package/src/internal/generateGroupMap/runtime_support.js +53 -0
- package/src/internal/jsenvInternalFiles.js +0 -1
- package/src/internal/node-launcher/createControllableNodeProcess.js +2 -3
- package/src/internal/response_validation.js +143 -0
- package/src/internal/runtime/createBrowserRuntime/createBrowserRuntime.js +8 -3
- package/src/internal/runtime/createBrowserRuntime/createBrowserSystem.js +165 -25
- package/src/internal/runtime/createBrowserRuntime/displayErrorInDocument.js +7 -6
- package/src/internal/runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js +124 -68
- package/src/internal/runtime/createNodeRuntime/createNodeRuntime.js +8 -86
- package/src/internal/runtime/createNodeRuntime/createNodeSystem.js +53 -9
- package/src/internal/runtime/createNodeRuntime/scanNodeRuntimeFeatures.js +115 -0
- package/src/internal/runtime/module-registration.js +86 -136
- package/src/internal/runtime/resolveGroup.js +2 -3
- package/src/internal/toolbar/compilation/toolbar.compilation.js +15 -17
- package/src/internal/toolbar/eventsource/toolbar.eventsource.js +35 -8
- package/src/internal/toolbar/toolbar.main.js +7 -4
- package/src/internal/url_utils.js +33 -0
- package/src/internal/url_utils.test.js +39 -0
- package/src/jsonToJavaScriptModule.js +12 -0
- package/src/launchBrowser.js +50 -34
- package/src/launchNode.js +6 -3
- package/src/requireUsingChildProcess.js +36 -32
- package/src/startExploring.js +25 -11
- package/src/internal/building/transformImportMetaUrlReferences.js +0 -71
- package/src/internal/runtime/resolveBrowserGroup.js +0 -5
- package/src/internal/runtime/resolveNodeGroup.js +0 -5
- package/src/internal/validateResponseStatusIsOk.js +0 -91
package/dist/jsenv_toolbar.js
CHANGED
|
@@ -2157,21 +2157,17 @@
|
|
|
2157
2157
|
version = _ref.version;
|
|
2158
2158
|
return Object.keys(groupMap).find(function (compileIdCandidate) {
|
|
2159
2159
|
var minRuntimeVersions = groupMap[compileIdCandidate].minRuntimeVersions;
|
|
2160
|
+
var versionForGroup = minRuntimeVersions[name];
|
|
2160
2161
|
|
|
2161
|
-
if (
|
|
2162
|
+
if (!versionForGroup) {
|
|
2162
2163
|
return false;
|
|
2163
2164
|
}
|
|
2164
2165
|
|
|
2165
|
-
var versionForGroup = minRuntimeVersions[name];
|
|
2166
2166
|
var highestVersion = findHighestVersion(version, versionForGroup);
|
|
2167
2167
|
return highestVersion === version;
|
|
2168
2168
|
});
|
|
2169
2169
|
};
|
|
2170
2170
|
|
|
2171
|
-
var resolveBrowserGroup = function resolveBrowserGroup(groupMap) {
|
|
2172
|
-
return resolveGroup(detectBrowser(), groupMap);
|
|
2173
|
-
};
|
|
2174
|
-
|
|
2175
2171
|
function _await(value, then, direct) {
|
|
2176
2172
|
if (direct) {
|
|
2177
2173
|
return then ? then(value) : value;
|
|
@@ -2211,6 +2207,16 @@
|
|
|
2211
2207
|
}
|
|
2212
2208
|
}
|
|
2213
2209
|
|
|
2210
|
+
function _invoke(body, then) {
|
|
2211
|
+
var result = body();
|
|
2212
|
+
|
|
2213
|
+
if (result && result.then) {
|
|
2214
|
+
return result.then(then);
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
return then(result);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2214
2220
|
function _catch(body, recover) {
|
|
2215
2221
|
try {
|
|
2216
2222
|
var result = body();
|
|
@@ -2227,8 +2233,8 @@
|
|
|
2227
2233
|
|
|
2228
2234
|
var scanBrowserRuntimeFeatures = _async$1(function () {
|
|
2229
2235
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2230
|
-
_ref$
|
|
2231
|
-
|
|
2236
|
+
_ref$coverageHandledF = _ref.coverageHandledFromOutside,
|
|
2237
|
+
coverageHandledFromOutside = _ref$coverageHandledF === void 0 ? false : _ref$coverageHandledF,
|
|
2232
2238
|
_ref$failFastOnFeatur = _ref.failFastOnFeatureDetection,
|
|
2233
2239
|
failFastOnFeatureDetection = _ref$failFastOnFeatur === void 0 ? false : _ref$failFastOnFeatur;
|
|
2234
2240
|
|
|
@@ -2241,57 +2247,56 @@
|
|
|
2241
2247
|
groupMap = _ref4[0],
|
|
2242
2248
|
envJson = _ref4[1];
|
|
2243
2249
|
|
|
2250
|
+
var browser = detectBrowser();
|
|
2244
2251
|
var compileId = computeCompileIdFromGroupId({
|
|
2245
|
-
groupId:
|
|
2252
|
+
groupId: resolveGroup(browser, groupMap),
|
|
2246
2253
|
groupMap: groupMap
|
|
2247
2254
|
});
|
|
2248
2255
|
var groupInfo = groupMap[compileId];
|
|
2249
2256
|
var inlineImportMapIntoHTML = envJson.inlineImportMapIntoHTML,
|
|
2250
2257
|
customCompilerPatterns = envJson.customCompilerPatterns;
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2258
|
+
var featuresReport = {
|
|
2259
|
+
importmap: undefined,
|
|
2260
|
+
dynamicImport: undefined,
|
|
2261
|
+
topLevelAwait: undefined,
|
|
2262
|
+
jsonImportAssertions: undefined,
|
|
2263
|
+
cssImportAssertions: undefined,
|
|
2264
|
+
newStylesheet: undefined
|
|
2265
|
+
};
|
|
2266
|
+
return _await(detectSupportedFeatures({
|
|
2267
|
+
featuresReport: featuresReport,
|
|
2257
2268
|
failFastOnFeatureDetection: failFastOnFeatureDetection,
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
coverageInstrumentationRequired: coverageInstrumentationRequired
|
|
2262
|
-
}), function (_getFeaturesReport) {
|
|
2263
|
-
var featuresReport = _objectSpread2(_objectSpread2({
|
|
2264
|
-
babelPluginRequiredNames: _babelPluginRequiredN
|
|
2265
|
-
}, _getFeaturesReport), {}, {
|
|
2266
|
-
customCompilerPatterns: customCompilerPatterns
|
|
2267
|
-
});
|
|
2268
|
-
|
|
2269
|
-
var canAvoidCompilation = featuresReport.customCompilerPatterns.length === 0 && featuresReport.jsenvPluginRequiredNames.length === 0 && featuresReport.babelPluginRequiredNames.length === 0 && featuresReport.importmapSupported && featuresReport.dynamicImportSupported && featuresReport.topLevelAwaitSupported;
|
|
2270
|
-
return {
|
|
2269
|
+
inlineImportMapIntoHTML: inlineImportMapIntoHTML
|
|
2270
|
+
}), function () {
|
|
2271
|
+
return _await(pluginRequiredNamesFromGroupInfo(groupInfo, {
|
|
2271
2272
|
featuresReport: featuresReport,
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2273
|
+
coverageHandledFromOutside: coverageHandledFromOutside
|
|
2274
|
+
}), function (pluginRequiredNameArray) {
|
|
2275
|
+
var canAvoidCompilation = customCompilerPatterns.length === 0 && pluginRequiredNameArray.length === 0 && featuresReport.importmap && featuresReport.dynamicImport && featuresReport.topLevelAwait;
|
|
2276
|
+
return {
|
|
2277
|
+
canAvoidCompilation: canAvoidCompilation,
|
|
2278
|
+
featuresReport: featuresReport,
|
|
2279
|
+
customCompilerPatterns: customCompilerPatterns,
|
|
2280
|
+
pluginRequiredNameArray: pluginRequiredNameArray,
|
|
2281
|
+
inlineImportMapIntoHTML: inlineImportMapIntoHTML,
|
|
2282
|
+
outDirectoryRelativeUrl: outDirectoryRelativeUrl,
|
|
2283
|
+
compileId: compileId,
|
|
2284
|
+
browser: browser
|
|
2285
|
+
};
|
|
2286
|
+
});
|
|
2277
2287
|
});
|
|
2278
2288
|
});
|
|
2279
2289
|
});
|
|
2280
2290
|
});
|
|
2281
2291
|
|
|
2282
|
-
var
|
|
2283
|
-
var
|
|
2284
|
-
|
|
2292
|
+
var detectSupportedFeatures = _async$1(function (_ref5) {
|
|
2293
|
+
var featuresReport = _ref5.featuresReport,
|
|
2294
|
+
failFastOnFeatureDetection = _ref5.failFastOnFeatureDetection,
|
|
2285
2295
|
inlineImportMapIntoHTML = _ref5.inlineImportMapIntoHTML;
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
topLevelAwaitSupported: undefined
|
|
2291
|
-
};
|
|
2292
|
-
var jsenvPluginRequiredNames = groupInfo.jsenvPluginRequiredNameArray;
|
|
2293
|
-
featuresReport.jsenvPluginRequiredNames = jsenvPluginRequiredNames;
|
|
2294
|
-
return jsenvPluginRequiredNames.length > 0 && failFastOnFeatureDetection ? featuresReport : _await(supportsImportmap({
|
|
2296
|
+
// start testing importmap support first and not in paralell
|
|
2297
|
+
// so that there is not module script loaded beore importmap is injected
|
|
2298
|
+
// it would log an error in chrome console and return undefined
|
|
2299
|
+
return _await(supportsImportmap({
|
|
2295
2300
|
// chrome supports inline but not remote importmap
|
|
2296
2301
|
// https://github.com/WICG/import-maps/issues/235
|
|
2297
2302
|
// at this stage we won't know if the html file will use
|
|
@@ -2301,32 +2306,80 @@
|
|
|
2301
2306
|
// and in that case we can test only the local importmap support
|
|
2302
2307
|
// so we test importmap support and the remote one
|
|
2303
2308
|
remote: !inlineImportMapIntoHTML
|
|
2304
|
-
}), function (
|
|
2305
|
-
featuresReport.
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
return
|
|
2309
|
-
|
|
2310
|
-
|
|
2309
|
+
}), function (importmap) {
|
|
2310
|
+
featuresReport.importmap = importmap;
|
|
2311
|
+
|
|
2312
|
+
if (!importmap && failFastOnFeatureDetection) {
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
return _call$1(supportsDynamicImport, function (dynamicImport) {
|
|
2317
|
+
featuresReport.dynamicImport = dynamicImport;
|
|
2318
|
+
|
|
2319
|
+
if (!dynamicImport && failFastOnFeatureDetection) {
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
return _call$1(supportsTopLevelAwait, function (topLevelAwait) {
|
|
2324
|
+
featuresReport.topLevelAwait = topLevelAwait;
|
|
2311
2325
|
});
|
|
2312
2326
|
});
|
|
2313
2327
|
});
|
|
2314
2328
|
});
|
|
2315
2329
|
|
|
2316
|
-
var
|
|
2317
|
-
var
|
|
2318
|
-
|
|
2319
|
-
var
|
|
2330
|
+
var pluginRequiredNamesFromGroupInfo = _async$1(function (groupInfo, _ref6) {
|
|
2331
|
+
var featuresReport = _ref6.featuresReport,
|
|
2332
|
+
coverageHandledFromOutside = _ref6.coverageHandledFromOutside;
|
|
2333
|
+
var pluginRequiredNameArray = groupInfo.pluginRequiredNameArray;
|
|
2334
|
+
var requiredPluginNames = pluginRequiredNameArray.slice();
|
|
2335
|
+
|
|
2336
|
+
var markPluginAsSupported = function markPluginAsSupported(name) {
|
|
2337
|
+
var index = requiredPluginNames.indexOf(name);
|
|
2338
|
+
|
|
2339
|
+
if (index > -1) {
|
|
2340
|
+
requiredPluginNames.splice(index, 1);
|
|
2341
|
+
}
|
|
2342
|
+
}; // When instrumentation CAN be handed by playwright
|
|
2320
2343
|
// https://playwright.dev/docs/api/class-chromiumcoverage#chromiumcoveragestartjscoverageoptions
|
|
2321
|
-
//
|
|
2344
|
+
// coverageHandledFromOutside is true and "transform-instrument" becomes non mandatory
|
|
2322
2345
|
|
|
2323
|
-
var transformInstrumentIndex = babelPluginRequiredNames.indexOf("transform-instrument");
|
|
2324
2346
|
|
|
2325
|
-
if (
|
|
2326
|
-
|
|
2347
|
+
if (coverageHandledFromOutside) {
|
|
2348
|
+
markPluginAsSupported("transform-instrument");
|
|
2327
2349
|
}
|
|
2328
2350
|
|
|
2329
|
-
return
|
|
2351
|
+
return _invoke(function () {
|
|
2352
|
+
if (pluginRequiredNameArray.includes("transform-import-assertions")) {
|
|
2353
|
+
return _call$1(supportsJsonImportAssertions, function (jsonImportAssertions) {
|
|
2354
|
+
featuresReport.jsonImportAssertions = jsonImportAssertions;
|
|
2355
|
+
return _call$1(supportsCssImportAssertions, function (cssImportAssertions) {
|
|
2356
|
+
featuresReport.cssImportAssertions = cssImportAssertions;
|
|
2357
|
+
|
|
2358
|
+
if (jsonImportAssertions && cssImportAssertions) {
|
|
2359
|
+
markPluginAsSupported("transform-import-assertions");
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
}, function () {
|
|
2365
|
+
if (pluginRequiredNameArray.includes("new-stylesheet-as-jsenv-import")) {
|
|
2366
|
+
var newStylesheet = supportsNewStylesheet();
|
|
2367
|
+
featuresReport.newStylesheet = newStylesheet;
|
|
2368
|
+
markPluginAsSupported("new-stylesheet-as-jsenv-import");
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
return requiredPluginNames;
|
|
2372
|
+
});
|
|
2373
|
+
});
|
|
2374
|
+
|
|
2375
|
+
var supportsNewStylesheet = function supportsNewStylesheet() {
|
|
2376
|
+
try {
|
|
2377
|
+
// eslint-disable-next-line no-new
|
|
2378
|
+
new CSSStyleSheet();
|
|
2379
|
+
return true;
|
|
2380
|
+
} catch (e) {
|
|
2381
|
+
return false;
|
|
2382
|
+
}
|
|
2330
2383
|
};
|
|
2331
2384
|
|
|
2332
2385
|
var supportsImportmap = _async$1(function () {
|
|
@@ -2334,9 +2387,9 @@
|
|
|
2334
2387
|
_ref7$remote = _ref7.remote,
|
|
2335
2388
|
remote = _ref7$remote === void 0 ? true : _ref7$remote;
|
|
2336
2389
|
|
|
2337
|
-
var specifier =
|
|
2390
|
+
var specifier = asBase64Url("export default false");
|
|
2338
2391
|
var importMap = {
|
|
2339
|
-
imports: _defineProperty({}, specifier,
|
|
2392
|
+
imports: _defineProperty({}, specifier, asBase64Url("export default true"))
|
|
2340
2393
|
};
|
|
2341
2394
|
var importmapScript = document.createElement("script");
|
|
2342
2395
|
var importmapString = JSON.stringify(importMap, null, " ");
|
|
@@ -2351,7 +2404,7 @@
|
|
|
2351
2404
|
document.body.appendChild(importmapScript);
|
|
2352
2405
|
var scriptModule = document.createElement("script");
|
|
2353
2406
|
scriptModule.type = "module";
|
|
2354
|
-
scriptModule.src =
|
|
2407
|
+
scriptModule.src = asBase64Url("import supported from \"".concat(specifier, "\"; window.__importmap_supported = supported"));
|
|
2355
2408
|
return new Promise(function (resolve, reject) {
|
|
2356
2409
|
scriptModule.onload = function () {
|
|
2357
2410
|
var supported = window.__importmap_supported;
|
|
@@ -2371,12 +2424,8 @@
|
|
|
2371
2424
|
});
|
|
2372
2425
|
});
|
|
2373
2426
|
|
|
2374
|
-
var jsToTextUrl = function jsToTextUrl(js) {
|
|
2375
|
-
return "data:text/javascript;base64,".concat(window.btoa(js));
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
2427
|
var supportsDynamicImport = _async$1(function () {
|
|
2379
|
-
var moduleSource =
|
|
2428
|
+
var moduleSource = asBase64Url("export default 42");
|
|
2380
2429
|
return _catch(function () {
|
|
2381
2430
|
return _await(import(moduleSource), function (namespace) {
|
|
2382
2431
|
return namespace.default === 42;
|
|
@@ -2387,7 +2436,7 @@
|
|
|
2387
2436
|
});
|
|
2388
2437
|
|
|
2389
2438
|
var supportsTopLevelAwait = _async$1(function () {
|
|
2390
|
-
var moduleSource =
|
|
2439
|
+
var moduleSource = asBase64Url("export default await Promise.resolve(42)");
|
|
2391
2440
|
return _catch(function () {
|
|
2392
2441
|
return _await(import(moduleSource), function (namespace) {
|
|
2393
2442
|
return namespace.default === 42;
|
|
@@ -2397,6 +2446,35 @@
|
|
|
2397
2446
|
});
|
|
2398
2447
|
});
|
|
2399
2448
|
|
|
2449
|
+
var supportsJsonImportAssertions = _async$1(function () {
|
|
2450
|
+
var jsonBase64Url = asBase64Url("42", "application/json");
|
|
2451
|
+
var moduleSource = asBase64Url("export { default } from \"".concat(jsonBase64Url, "\" assert { type: \"json\" }"));
|
|
2452
|
+
return _catch(function () {
|
|
2453
|
+
return _await(import(moduleSource), function (namespace) {
|
|
2454
|
+
return namespace.default === 42;
|
|
2455
|
+
});
|
|
2456
|
+
}, function () {
|
|
2457
|
+
return false;
|
|
2458
|
+
});
|
|
2459
|
+
});
|
|
2460
|
+
|
|
2461
|
+
var supportsCssImportAssertions = _async$1(function () {
|
|
2462
|
+
var cssBase64Url = asBase64Url("p { color: red; }", "text/css");
|
|
2463
|
+
var moduleSource = asBase64Url("export { default } from \"".concat(cssBase64Url, "\" assert { type: \"css\" }"));
|
|
2464
|
+
return _catch(function () {
|
|
2465
|
+
return _await(import(moduleSource), function (namespace) {
|
|
2466
|
+
return namespace.default instanceof CSSStyleSheet;
|
|
2467
|
+
});
|
|
2468
|
+
}, function () {
|
|
2469
|
+
return false;
|
|
2470
|
+
});
|
|
2471
|
+
});
|
|
2472
|
+
|
|
2473
|
+
var asBase64Url = function asBase64Url(text) {
|
|
2474
|
+
var mimeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "application/javascript";
|
|
2475
|
+
return "data:".concat(mimeType, ";base64,").concat(window.btoa(text));
|
|
2476
|
+
};
|
|
2477
|
+
|
|
2400
2478
|
var renderCompilationInToolbar = function renderCompilationInToolbar(_ref) {
|
|
2401
2479
|
var compileGroup = _ref.compileGroup;
|
|
2402
2480
|
var browserSupportRootNode = document.querySelector("#browser_support");
|
|
@@ -2404,8 +2482,10 @@
|
|
|
2404
2482
|
removeForceHideElement(browserSupportRootNode);
|
|
2405
2483
|
removeForceHideElement(filesCompilationRootNode);
|
|
2406
2484
|
scanBrowserRuntimeFeatures().then(function (_ref2) {
|
|
2407
|
-
var
|
|
2408
|
-
|
|
2485
|
+
var canAvoidCompilation = _ref2.canAvoidCompilation,
|
|
2486
|
+
featuresReport = _ref2.featuresReport,
|
|
2487
|
+
customCompilerPatterns = _ref2.customCompilerPatterns,
|
|
2488
|
+
pluginRequiredNameArray = _ref2.pluginRequiredNameArray,
|
|
2409
2489
|
inlineImportMapIntoHTML = _ref2.inlineImportMapIntoHTML,
|
|
2410
2490
|
outDirectoryRelativeUrl = _ref2.outDirectoryRelativeUrl,
|
|
2411
2491
|
compileId = _ref2.compileId;
|
|
@@ -2420,6 +2500,8 @@
|
|
|
2420
2500
|
window.alert("Source files needs to be compiled to be executable in this browser because: ".concat(getBrowserSupportMessage({
|
|
2421
2501
|
missingOnly: true,
|
|
2422
2502
|
featuresReport: featuresReport,
|
|
2503
|
+
customCompilerPatterns: customCompilerPatterns,
|
|
2504
|
+
pluginRequiredNameArray: pluginRequiredNameArray,
|
|
2423
2505
|
inlineImportMapIntoHTML: inlineImportMapIntoHTML
|
|
2424
2506
|
})));
|
|
2425
2507
|
};
|
|
@@ -2428,6 +2510,8 @@
|
|
|
2428
2510
|
// eslint-disable-next-line no-alert
|
|
2429
2511
|
window.alert("Source files (except html) can be executed directly in this browser because: ".concat(getBrowserSupportMessage({
|
|
2430
2512
|
featuresReport: featuresReport,
|
|
2513
|
+
customCompilerPatterns: customCompilerPatterns,
|
|
2514
|
+
pluginRequiredNameArray: pluginRequiredNameArray,
|
|
2431
2515
|
inlineImportMapIntoHTML: inlineImportMapIntoHTML
|
|
2432
2516
|
})));
|
|
2433
2517
|
};
|
|
@@ -2436,6 +2520,8 @@
|
|
|
2436
2520
|
// eslint-disable-next-line no-alert
|
|
2437
2521
|
window.alert("Source files can be executed directly in this browser because: ".concat(getBrowserSupportMessage({
|
|
2438
2522
|
featuresReport: featuresReport,
|
|
2523
|
+
customCompilerPatterns: customCompilerPatterns,
|
|
2524
|
+
pluginRequiredNameArray: pluginRequiredNameArray,
|
|
2439
2525
|
inlineImportMapIntoHTML: inlineImportMapIntoHTML
|
|
2440
2526
|
})));
|
|
2441
2527
|
};
|
|
@@ -2472,6 +2558,8 @@
|
|
|
2472
2558
|
var getBrowserSupportMessage = function getBrowserSupportMessage(_ref3) {
|
|
2473
2559
|
var missingOnly = _ref3.missingOnly,
|
|
2474
2560
|
featuresReport = _ref3.featuresReport,
|
|
2561
|
+
customCompilerPatterns = _ref3.customCompilerPatterns,
|
|
2562
|
+
pluginRequiredNameArray = _ref3.pluginRequiredNameArray,
|
|
2475
2563
|
inlineImportMapIntoHTML = _ref3.inlineImportMapIntoHTML;
|
|
2476
2564
|
var parts = [];
|
|
2477
2565
|
var importmapSupported = featuresReport.importmapSupported;
|
|
@@ -2508,31 +2596,22 @@
|
|
|
2508
2596
|
parts.push("top level await is not supported");
|
|
2509
2597
|
}
|
|
2510
2598
|
|
|
2511
|
-
var
|
|
2512
|
-
var babelPluginRequiredCount = babelPluginRequiredNames.length;
|
|
2599
|
+
var pluginRequiredCount = pluginRequiredNameArray.length;
|
|
2513
2600
|
|
|
2514
|
-
if (
|
|
2601
|
+
if (pluginRequiredCount === 0) {
|
|
2515
2602
|
if (!missingOnly) {
|
|
2516
|
-
parts.push("all
|
|
2603
|
+
parts.push("all plugins are natively supported");
|
|
2517
2604
|
}
|
|
2518
2605
|
} else {
|
|
2519
|
-
parts.push("".concat(
|
|
2606
|
+
parts.push("".concat(pluginRequiredCount, " plugins are mandatory: ").concat(pluginRequiredNameArray));
|
|
2520
2607
|
}
|
|
2521
2608
|
|
|
2522
|
-
var customCompilerPatterns = featuresReport.customCompilerPatterns;
|
|
2523
2609
|
var customCompilerCount = customCompilerPatterns.length;
|
|
2524
2610
|
|
|
2525
2611
|
if (customCompilerCount === 0) ; else {
|
|
2526
2612
|
parts.push("".concat(customCompilerCount, " custom compilers enabled: ").concat(customCompilerPatterns));
|
|
2527
2613
|
}
|
|
2528
2614
|
|
|
2529
|
-
var jsenvPluginRequiredNames = featuresReport.jsenvPluginRequiredNames;
|
|
2530
|
-
var jsenvPluginRequiredCount = jsenvPluginRequiredNames.length;
|
|
2531
|
-
|
|
2532
|
-
if (jsenvPluginRequiredCount === 0) ; else {
|
|
2533
|
-
parts.push("".concat(jsenvPluginRequiredCount, " jsenv plugins are mandatory: ").concat(jsenvPluginRequiredNames));
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
2615
|
return "\n- ".concat(parts.join("\n- "));
|
|
2537
2616
|
};
|
|
2538
2617
|
|
|
@@ -2858,8 +2937,17 @@
|
|
|
2858
2937
|
var initToolbarEventSource = function initToolbarEventSource(_ref) {
|
|
2859
2938
|
var executedFileRelativeUrl = _ref.executedFileRelativeUrl,
|
|
2860
2939
|
livereloading = _ref.livereloading;
|
|
2940
|
+
|
|
2941
|
+
var getLivereloadCallback = function getLivereloadCallback(originalFileProjectRelativeUrl) {
|
|
2942
|
+
var callbacks = window.parent.__jsenv__.livereloadingCallbacks;
|
|
2943
|
+
return callbacks[originalFileProjectRelativeUrl];
|
|
2944
|
+
};
|
|
2945
|
+
|
|
2861
2946
|
removeForceHideElement(document.querySelector("#eventsource-indicator"));
|
|
2862
|
-
connectEventSource(
|
|
2947
|
+
connectEventSource({
|
|
2948
|
+
executedFileRelativeUrl: executedFileRelativeUrl,
|
|
2949
|
+
getLivereloadCallback: getLivereloadCallback
|
|
2950
|
+
});
|
|
2863
2951
|
livereloadingAvailableOnServer = livereloading;
|
|
2864
2952
|
|
|
2865
2953
|
if (!livereloadingAvailableOnServer) {
|
|
@@ -2894,12 +2982,21 @@
|
|
|
2894
2982
|
var eventSourceConnection;
|
|
2895
2983
|
var connectionReadyPromise;
|
|
2896
2984
|
|
|
2897
|
-
var handleFileChange = function handleFileChange(
|
|
2898
|
-
|
|
2985
|
+
var handleFileChange = function handleFileChange(_ref2) {
|
|
2986
|
+
var file = _ref2.file,
|
|
2987
|
+
eventType = _ref2.eventType,
|
|
2988
|
+
livereloadCallback = _ref2.livereloadCallback;
|
|
2989
|
+
latestChangeMap[file] = eventType;
|
|
2899
2990
|
updateEventSourceIndicator();
|
|
2900
2991
|
|
|
2901
2992
|
if (shouldLivereload()) {
|
|
2902
|
-
if (
|
|
2993
|
+
if (livereloadCallback) {
|
|
2994
|
+
livereloadCallback({
|
|
2995
|
+
file: file,
|
|
2996
|
+
latestChangeMap: latestChangeMap,
|
|
2997
|
+
reloadPage: reloadPage
|
|
2998
|
+
});
|
|
2999
|
+
} else if (file.endsWith(".css") || file.endsWith(".scss") || file.endsWith(".sass")) {
|
|
2903
3000
|
reloadAllCss();
|
|
2904
3001
|
delete latestChangeMap[file];
|
|
2905
3002
|
updateEventSourceIndicator();
|
|
@@ -2950,45 +3047,59 @@
|
|
|
2950
3047
|
}
|
|
2951
3048
|
};
|
|
2952
3049
|
|
|
2953
|
-
var connectEventSource = function connectEventSource(
|
|
3050
|
+
var connectEventSource = function connectEventSource(_ref3) {
|
|
3051
|
+
var executedFileRelativeUrl = _ref3.executedFileRelativeUrl,
|
|
3052
|
+
getLivereloadCallback = _ref3.getLivereloadCallback;
|
|
2954
3053
|
updateEventSourceIndicator();
|
|
2955
3054
|
connectionReadyPromise = createPromiseAndHooks();
|
|
2956
3055
|
eventSourceConnection = connectCompileServerEventSource(executedFileRelativeUrl, {
|
|
2957
3056
|
onFileModified: function onFileModified(file) {
|
|
2958
|
-
handleFileChange(
|
|
3057
|
+
handleFileChange({
|
|
3058
|
+
file: file,
|
|
3059
|
+
eventType: "modified",
|
|
3060
|
+
livereloadCallback: getLivereloadCallback(file)
|
|
3061
|
+
});
|
|
2959
3062
|
},
|
|
2960
3063
|
onFileRemoved: function onFileRemoved(file) {
|
|
2961
|
-
handleFileChange(
|
|
3064
|
+
handleFileChange({
|
|
3065
|
+
file: file,
|
|
3066
|
+
eventType: "removed",
|
|
3067
|
+
livereloadCallback: getLivereloadCallback(file)
|
|
3068
|
+
});
|
|
2962
3069
|
},
|
|
2963
3070
|
onFileAdded: function onFileAdded(file) {
|
|
2964
|
-
handleFileChange(
|
|
3071
|
+
handleFileChange({
|
|
3072
|
+
file: file,
|
|
3073
|
+
eventType: "added",
|
|
3074
|
+
livereloadCallback: getLivereloadCallback(file)
|
|
3075
|
+
});
|
|
2965
3076
|
},
|
|
2966
|
-
onConnecting: function onConnecting(
|
|
2967
|
-
var cancel =
|
|
3077
|
+
onConnecting: function onConnecting(_ref4) {
|
|
3078
|
+
var cancel = _ref4.cancel;
|
|
2968
3079
|
eventSourceState = "connecting";
|
|
2969
3080
|
eventSourceHooks = {
|
|
2970
3081
|
abort: cancel
|
|
2971
3082
|
};
|
|
2972
3083
|
updateEventSourceIndicator();
|
|
2973
3084
|
},
|
|
2974
|
-
onConnectionCancelled: function onConnectionCancelled(
|
|
2975
|
-
var connect =
|
|
3085
|
+
onConnectionCancelled: function onConnectionCancelled(_ref5) {
|
|
3086
|
+
var connect = _ref5.connect;
|
|
2976
3087
|
eventSourceState = "disabled";
|
|
2977
3088
|
eventSourceHooks = {
|
|
2978
3089
|
connect: connect
|
|
2979
3090
|
};
|
|
2980
3091
|
updateEventSourceIndicator();
|
|
2981
3092
|
},
|
|
2982
|
-
onConnectionFailed: function onConnectionFailed(
|
|
2983
|
-
var connect =
|
|
3093
|
+
onConnectionFailed: function onConnectionFailed(_ref6) {
|
|
3094
|
+
var connect = _ref6.connect;
|
|
2984
3095
|
eventSourceState = "failed";
|
|
2985
3096
|
eventSourceHooks = {
|
|
2986
3097
|
reconnect: connect
|
|
2987
3098
|
};
|
|
2988
3099
|
updateEventSourceIndicator();
|
|
2989
3100
|
},
|
|
2990
|
-
onConnected: function onConnected(
|
|
2991
|
-
var cancel =
|
|
3101
|
+
onConnected: function onConnected(_ref7) {
|
|
3102
|
+
var cancel = _ref7.cancel;
|
|
2992
3103
|
eventSourceState = "connected";
|
|
2993
3104
|
eventSourceHooks = {
|
|
2994
3105
|
disconnect: cancel
|
|
@@ -3348,10 +3459,10 @@
|
|
|
3348
3459
|
var executedFileCompiledUrl = _ref3.executedFileCompiledUrl,
|
|
3349
3460
|
outDirectoryRelativeUrl = _ref3.outDirectoryRelativeUrl,
|
|
3350
3461
|
compileServerOrigin = _ref3.compileServerOrigin;
|
|
3351
|
-
var
|
|
3462
|
+
var outDirectoryServerUrl = String(new URL(outDirectoryRelativeUrl, compileServerOrigin));
|
|
3352
3463
|
|
|
3353
|
-
if (urlIsInsideOf(executedFileCompiledUrl,
|
|
3354
|
-
var afterCompileDirectory = urlToRelativeUrl(executedFileCompiledUrl,
|
|
3464
|
+
if (urlIsInsideOf(executedFileCompiledUrl, outDirectoryServerUrl)) {
|
|
3465
|
+
var afterCompileDirectory = urlToRelativeUrl(executedFileCompiledUrl, outDirectoryServerUrl);
|
|
3355
3466
|
var slashIndex = afterCompileDirectory.indexOf("/");
|
|
3356
3467
|
var fileRelativeUrl = afterCompileDirectory.slice(slashIndex + 1);
|
|
3357
3468
|
return {
|