@stencil/core 5.0.0-rc.4 → 5.0.0-rc.5
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/compiler/browser.js
CHANGED
|
@@ -1845,7 +1845,7 @@ const validateComponentTag = (tag) => {
|
|
|
1845
1845
|
};
|
|
1846
1846
|
//#endregion
|
|
1847
1847
|
//#region src/version.ts
|
|
1848
|
-
const version = "5.0.0-rc.
|
|
1848
|
+
const version = "5.0.0-rc.5";
|
|
1849
1849
|
//#endregion
|
|
1850
1850
|
//#region src/compiler/events.ts
|
|
1851
1851
|
const buildEvents = () => {
|
|
@@ -4140,6 +4140,7 @@ const autoprefixCss = async (cssText, opts, filePath, minify = false) => {
|
|
|
4140
4140
|
};
|
|
4141
4141
|
if (typeof e.name === "string") diagnostic.header = e.name;
|
|
4142
4142
|
if (typeof e.message === "string") diagnostic.messageText = e.message;
|
|
4143
|
+
if (e.data?.type === "SelectorError" && e.loc && typeof e.loc.line === "number") diagnostic.messageText = getSelectorErrorMessage(typeof e.source === "string" ? e.source : cssText, e.loc, diagnostic.messageText, e.data.value?.type);
|
|
4143
4144
|
if (filePath) diagnostic.absFilePath = filePath;
|
|
4144
4145
|
else if (typeof e.fileName === "string" && e.fileName !== "style.css") diagnostic.absFilePath = e.fileName;
|
|
4145
4146
|
if (e.loc && typeof e.loc.line === "number") {
|
|
@@ -4169,6 +4170,25 @@ const autoprefixCss = async (cssText, opts, filePath, minify = false) => {
|
|
|
4169
4170
|
return output;
|
|
4170
4171
|
};
|
|
4171
4172
|
/**
|
|
4173
|
+
* Lightning CSS selector errors (e.g. `Invalid state`) don't name the selector, and for
|
|
4174
|
+
* preprocessed styles the reported line is in the compiled CSS, not the source file.
|
|
4175
|
+
* @param sourceText the CSS that failed to parse
|
|
4176
|
+
* @param loc the 1-based error location reported by Lightning CSS
|
|
4177
|
+
* @param loc.line the error line
|
|
4178
|
+
* @param loc.column the error column
|
|
4179
|
+
* @param message the original error message
|
|
4180
|
+
* @param errorType the Lightning CSS selector error type
|
|
4181
|
+
* @returns a message that includes the offending selector
|
|
4182
|
+
*/
|
|
4183
|
+
const getSelectorErrorMessage = (sourceText, loc, message, errorType) => {
|
|
4184
|
+
const offset = sourceText.split("\n").slice(0, loc.line - 1).reduce((acc, line) => acc + line.length + 1, 0) + (loc.column ?? 1) - 1;
|
|
4185
|
+
const start = Math.max(sourceText.lastIndexOf("{", offset), sourceText.lastIndexOf("}", offset), sourceText.lastIndexOf(";", offset));
|
|
4186
|
+
const end = sourceText.indexOf("{", offset);
|
|
4187
|
+
const selector = sourceText.slice(start + 1, end === -1 ? void 0 : end).trim();
|
|
4188
|
+
if (!selector) return message;
|
|
4189
|
+
return `Invalid CSS selector "${selector}": ${message}.${errorType === "InvalidState" ? ` A pseudo-class can't follow a pseudo-element (e.g. \`::before:dir(rtl)\`); move it before (\`:dir(rtl)::before\`).` : ""}`;
|
|
4190
|
+
};
|
|
4191
|
+
/**
|
|
4172
4192
|
* Default browserslist targets used when autoprefixing CSS.
|
|
4173
4193
|
* Targets ES2017 browsers (2022+) only.
|
|
4174
4194
|
*/
|
package/dist/compiler/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-
|
|
1
|
+
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-CxfLkFCX.mjs";
|
|
2
2
|
import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bsfi3pOs.mjs";
|
|
3
3
|
export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
|
|
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
461
461
|
};
|
|
462
462
|
//#endregion
|
|
463
463
|
//#region src/version.ts
|
|
464
|
-
const version = "5.0.0-rc.
|
|
465
|
-
const buildId = "
|
|
466
|
-
const vermoji = "
|
|
464
|
+
const version = "5.0.0-rc.5";
|
|
465
|
+
const buildId = "1795169814";
|
|
466
|
+
const vermoji = "🗻";
|
|
467
467
|
/**
|
|
468
468
|
* Get the installed version of a tool/dependency.
|
|
469
469
|
* Handles packages with exports maps that point to subdirectories.
|
|
@@ -7983,6 +7983,31 @@ const generateRolldownOutput = async (build, options, config, entryModules) => {
|
|
|
7983
7983
|
});
|
|
7984
7984
|
};
|
|
7985
7985
|
//#endregion
|
|
7986
|
+
//#region src/compiler/output-targets/dist-lazy/cjs-import-meta-url-plugin.ts
|
|
7987
|
+
/**
|
|
7988
|
+
* With `platform: 'browser'` (shared with the ESM output), Rolldown renders `import.meta.url`
|
|
7989
|
+
* in CJS as `{}.url`. Replace it with the same expression Rolldown emits for `platform: 'node'`.
|
|
7990
|
+
*/
|
|
7991
|
+
const EMPTY_IMPORT_META_URL = /\{\}\.url\b/g;
|
|
7992
|
+
const CJS_FILE_URL = `require("url").pathToFileURL(__filename).href`;
|
|
7993
|
+
/**
|
|
7994
|
+
* A Rolldown output plugin that restores `import.meta.url` in CJS chunks.
|
|
7995
|
+
* @param sourceMap whether to generate a source map for the replacement
|
|
7996
|
+
* @returns a Rolldown plugin
|
|
7997
|
+
*/
|
|
7998
|
+
const cjsImportMetaUrlPlugin = (sourceMap) => ({
|
|
7999
|
+
name: "cjsImportMetaUrlPlugin",
|
|
8000
|
+
renderChunk(code) {
|
|
8001
|
+
if (!code.includes("{}.url")) return null;
|
|
8002
|
+
const s = new MagicString(code);
|
|
8003
|
+
s.replaceAll(EMPTY_IMPORT_META_URL, CJS_FILE_URL);
|
|
8004
|
+
return {
|
|
8005
|
+
code: s.toString(),
|
|
8006
|
+
map: sourceMap ? s.generateMap({ hires: true }) : null
|
|
8007
|
+
};
|
|
8008
|
+
}
|
|
8009
|
+
});
|
|
8010
|
+
//#endregion
|
|
7986
8011
|
//#region src/compiler/output-targets/dist-lazy/write-lazy-entry-module.ts
|
|
7987
8012
|
const writeLazyModule = async (compilerCtx, outputTargetType, destinations, code, sourceMap, rolldownResult) => {
|
|
7988
8013
|
const fileName = rolldownResult.fileName;
|
|
@@ -8325,7 +8350,7 @@ const generateCjs = async (config, compilerCtx, buildCtx, rolldownBuild, outputT
|
|
|
8325
8350
|
entryFileNames: "[name].cjs",
|
|
8326
8351
|
assetFileNames: "[name]-[hash][extname]",
|
|
8327
8352
|
...getRolldownSourceMapOptions(config),
|
|
8328
|
-
plugins: [lazyBundleIdPlugin(buildCtx, config, false, 8, ".cjs")]
|
|
8353
|
+
plugins: [lazyBundleIdPlugin(buildCtx, config, false, 8, ".cjs"), cjsImportMetaUrlPlugin(!!config.sourceMap)]
|
|
8329
8354
|
};
|
|
8330
8355
|
if (config.compat.enableImportInjection) esmOpts.dynamicImportInCjs = false;
|
|
8331
8356
|
const results = await generateRolldownOutput(rolldownBuild, esmOpts, config, buildCtx.entryModules);
|
|
@@ -8333,6 +8358,7 @@ const generateCjs = async (config, compilerCtx, buildCtx, rolldownBuild, outputT
|
|
|
8333
8358
|
const destinations = cjsOutputs.map((o) => o.cjsDir).filter((cjsDir) => typeof cjsDir === "string");
|
|
8334
8359
|
buildCtx.commonJsComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, destinations, results, "es2022", false);
|
|
8335
8360
|
await generateShortcuts$1(compilerCtx, results, cjsOutputs);
|
|
8361
|
+
await writeCjsPackageJson(compilerCtx, cjsOutputs);
|
|
8336
8362
|
}
|
|
8337
8363
|
}
|
|
8338
8364
|
return {
|
|
@@ -8340,6 +8366,14 @@ const generateCjs = async (config, compilerCtx, buildCtx, rolldownBuild, outputT
|
|
|
8340
8366
|
buildCtx
|
|
8341
8367
|
};
|
|
8342
8368
|
};
|
|
8369
|
+
/**
|
|
8370
|
+
* Chunks and lazy entries in the CJS dir keep a `.js` extension, so scope them as CommonJS
|
|
8371
|
+
* in case the consuming package sets `"type": "module"`.
|
|
8372
|
+
* @param compilerCtx the current compiler context
|
|
8373
|
+
* @param outputTargets the output targets with a CJS dir
|
|
8374
|
+
* @returns a promise that resolves once each `package.json` is written
|
|
8375
|
+
*/
|
|
8376
|
+
const writeCjsPackageJson = (compilerCtx, outputTargets) => Promise.all(outputTargets.map((o) => compilerCtx.fs.writeFile(join$2(o.cjsDir, "package.json"), `{"type":"commonjs"}\n`, { outputTargetType: o.type })));
|
|
8343
8377
|
const generateShortcuts$1 = (compilerCtx, rolldownResult, outputTargets) => {
|
|
8344
8378
|
const indexFilename = rolldownResult.find((r) => r.type === "chunk" && r.isIndex).fileName;
|
|
8345
8379
|
return Promise.all(outputTargets.map(async (o) => {
|
|
@@ -20474,7 +20508,7 @@ const validateFilesField = async (config, compilerCtx, buildCtx) => {
|
|
|
20474
20508
|
const packageJsonDir = dirname$1(config.packageJsonFilePath);
|
|
20475
20509
|
const absPath = join$2(packageJsonDir, pkgFile);
|
|
20476
20510
|
if (!await compilerCtx.fs.access(absPath)) {
|
|
20477
|
-
const msg = `
|
|
20511
|
+
const msg = `"${pkgFile}" is listed in the package.json "files" array but could not be found on disk.`;
|
|
20478
20512
|
packageJsonError(config, compilerCtx, buildCtx, msg, `"${pkgFile}"`);
|
|
20479
20513
|
}
|
|
20480
20514
|
}
|
|
@@ -23867,6 +23901,7 @@ const autoprefixCss = async (cssText, opts, filePath, minify = false) => {
|
|
|
23867
23901
|
};
|
|
23868
23902
|
if (typeof e.name === "string") diagnostic.header = e.name;
|
|
23869
23903
|
if (typeof e.message === "string") diagnostic.messageText = e.message;
|
|
23904
|
+
if (e.data?.type === "SelectorError" && e.loc && typeof e.loc.line === "number") diagnostic.messageText = getSelectorErrorMessage(typeof e.source === "string" ? e.source : cssText, e.loc, diagnostic.messageText, e.data.value?.type);
|
|
23870
23905
|
if (filePath) diagnostic.absFilePath = filePath;
|
|
23871
23906
|
else if (typeof e.fileName === "string" && e.fileName !== "style.css") diagnostic.absFilePath = e.fileName;
|
|
23872
23907
|
if (e.loc && typeof e.loc.line === "number") {
|
|
@@ -23896,6 +23931,25 @@ const autoprefixCss = async (cssText, opts, filePath, minify = false) => {
|
|
|
23896
23931
|
return output;
|
|
23897
23932
|
};
|
|
23898
23933
|
/**
|
|
23934
|
+
* Lightning CSS selector errors (e.g. `Invalid state`) don't name the selector, and for
|
|
23935
|
+
* preprocessed styles the reported line is in the compiled CSS, not the source file.
|
|
23936
|
+
* @param sourceText the CSS that failed to parse
|
|
23937
|
+
* @param loc the 1-based error location reported by Lightning CSS
|
|
23938
|
+
* @param loc.line the error line
|
|
23939
|
+
* @param loc.column the error column
|
|
23940
|
+
* @param message the original error message
|
|
23941
|
+
* @param errorType the Lightning CSS selector error type
|
|
23942
|
+
* @returns a message that includes the offending selector
|
|
23943
|
+
*/
|
|
23944
|
+
const getSelectorErrorMessage = (sourceText, loc, message, errorType) => {
|
|
23945
|
+
const offset = sourceText.split("\n").slice(0, loc.line - 1).reduce((acc, line) => acc + line.length + 1, 0) + (loc.column ?? 1) - 1;
|
|
23946
|
+
const start = Math.max(sourceText.lastIndexOf("{", offset), sourceText.lastIndexOf("}", offset), sourceText.lastIndexOf(";", offset));
|
|
23947
|
+
const end = sourceText.indexOf("{", offset);
|
|
23948
|
+
const selector = sourceText.slice(start + 1, end === -1 ? void 0 : end).trim();
|
|
23949
|
+
if (!selector) return message;
|
|
23950
|
+
return `Invalid CSS selector "${selector}": ${message}.${errorType === "InvalidState" ? ` A pseudo-class can't follow a pseudo-element (e.g. \`::before:dir(rtl)\`); move it before (\`:dir(rtl)::before\`).` : ""}`;
|
|
23951
|
+
};
|
|
23952
|
+
/**
|
|
23899
23953
|
* Default browserslist targets used when autoprefixing CSS.
|
|
23900
23954
|
* Targets ES2017 browsers (2022+) only.
|
|
23901
23955
|
*/
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-CxfLkFCX.mjs";
|
|
2
2
|
import { t as createNodeSys } from "../../node-Bsfi3pOs.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
package/dist/testing/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.5",
|
|
4
4
|
"description": "A Compiler for Web Components and Progressive Web Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"terser": "^5.50.0",
|
|
127
127
|
"tinyglobby": "^0.2.17",
|
|
128
128
|
"typescript": ">5.0.0 <7.0.0",
|
|
129
|
-
"@stencil/cli": "5.0.0-rc.
|
|
130
|
-
"@stencil/dev-server": "5.0.0-rc.
|
|
131
|
-
"@stencil/mock-doc": "5.0.0-rc.
|
|
129
|
+
"@stencil/cli": "5.0.0-rc.5",
|
|
130
|
+
"@stencil/dev-server": "5.0.0-rc.5",
|
|
131
|
+
"@stencil/mock-doc": "5.0.0-rc.5"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@ionic/prettier-config": "^4.0.0",
|