@stencil/core 3.0.0 → 3.0.1-dev.1677186661.ca7407c
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/cli/index.cjs +1 -133
- package/cli/index.js +1 -133
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +133 -148
- package/compiler/stencil.min.js +2 -2
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +26 -4
- package/dev-server/ws.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +8 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/hydrate/runner.js +43 -43
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +9 -0
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +5 -5
- package/mock-doc/index.js +5 -5
- package/mock-doc/package.json +1 -1
- package/package.json +10 -11
- package/readme.md +1 -1
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/glob.js +1 -1
- package/sys/node/index.js +93 -97
- package/sys/node/node-fetch.js +1 -1
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +338 -338
- package/testing/package.json +1 -1
- package/dependencies.json +0 -120
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Patch Esm
|
|
2
|
+
Stencil Client Patch Esm v0.0.0-dev.20230223211151 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __assign=undefined&&undefined.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector="";};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r);}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE;}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return "\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@",VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return {start:s,end:s+n[0].length}}return null}function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return {start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t);}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else {if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s);}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value;}));}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0);})),!t)return "break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return [];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t});})),t++;})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o});}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement;}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors);})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return ":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return {original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return !1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t));}));}function reScope(e,t){var r=e.template.map((function(r){return "string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t);}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t);})).observe(document.head,{childList:!0});}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove();}})).catch((function(e){console.error(e);}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1;}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}));}));})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal();}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal();},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e);},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n);}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes);},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document));}("undefined"!=typeof window&&window);
|
package/internal/client/dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Patch Browser
|
|
2
|
+
Stencil Client Patch Browser v0.0.0-dev.20230223211151 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
(function(){
|
|
5
5
|
var aa=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function g(a){var b=aa.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return !b&&a}function l(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return !(!a||!(a.__CE_isImportDocument||a instanceof Document))}
|
package/internal/client/index.js
CHANGED
|
@@ -19,7 +19,7 @@ let renderingRef = null;
|
|
|
19
19
|
let queueCongestion = 0;
|
|
20
20
|
let queuePending = false;
|
|
21
21
|
/*
|
|
22
|
-
Stencil Client Platform
|
|
22
|
+
Stencil Client Platform v0.0.0-dev.20230223211151 | MIT Licensed | https://stenciljs.com
|
|
23
23
|
*/
|
|
24
24
|
import { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';
|
|
25
25
|
const Build = {
|
|
@@ -143,6 +143,13 @@ const EMPTY_OBJ = {};
|
|
|
143
143
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
144
144
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
145
145
|
const isDef = (v) => v != null;
|
|
146
|
+
/**
|
|
147
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
|
148
|
+
* function.
|
|
149
|
+
*
|
|
150
|
+
* @param o the value to check
|
|
151
|
+
* @returns whether it's a complex type or not
|
|
152
|
+
*/
|
|
146
153
|
const isComplexType = (o) => {
|
|
147
154
|
// https://jsperf.com/typeof-fn-object/5
|
|
148
155
|
o = typeof o;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.0-dev.20230223211151",
|
|
4
4
|
"description": "Stencil internal client platform to be imported by the Stencil Compiler and internal runtime. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Patch Browser
|
|
2
|
+
Stencil Client Patch Browser v0.0.0-dev.20230223211151 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
import { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';
|
|
5
5
|
import { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Patch Esm
|
|
2
|
+
Stencil Client Patch Esm v0.0.0-dev.20230223211151 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
import { BUILD } from '@stencil/core/internal/app-data';
|
|
5
5
|
import { CSS, plt, win, promiseResolve } from '@stencil/core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/hydrate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.0-dev.20230223211151",
|
|
4
4
|
"description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|
|
@@ -279,37 +279,7 @@ function afterHydrate(e, t, r, s) {
|
|
|
279
279
|
function finalizeHydrate(e, t, r, s, n) {
|
|
280
280
|
try {
|
|
281
281
|
if (inspectElement(s, t.documentElement, 0), !1 !== r.removeUnusedStyles) try {
|
|
282
|
-
(
|
|
283
|
-
try {
|
|
284
|
-
const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
|
|
285
|
-
if (s > 0) {
|
|
286
|
-
const n = (e => {
|
|
287
|
-
const t = {
|
|
288
|
-
attrs: new Set,
|
|
289
|
-
classNames: new Set,
|
|
290
|
-
ids: new Set,
|
|
291
|
-
tags: new Set
|
|
292
|
-
};
|
|
293
|
-
return collectUsedSelectors(t, e), t;
|
|
294
|
-
})(e.documentElement);
|
|
295
|
-
for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
|
|
296
|
-
}
|
|
297
|
-
} catch (e) {
|
|
298
|
-
((e, t, r) => {
|
|
299
|
-
const s = {
|
|
300
|
-
level: "error",
|
|
301
|
-
type: "build",
|
|
302
|
-
header: "Build Error",
|
|
303
|
-
messageText: "build error",
|
|
304
|
-
relFilePath: null,
|
|
305
|
-
absFilePath: null,
|
|
306
|
-
lines: []
|
|
307
|
-
};
|
|
308
|
-
null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.length ? t.message : "UNKNOWN ERROR" : s.messageText = t.toString()),
|
|
309
|
-
null == e || shouldIgnoreError(s.messageText) || e.push(s);
|
|
310
|
-
})(t, e);
|
|
311
|
-
}
|
|
312
|
-
})(t, s.diagnostics);
|
|
282
|
+
removeUnusedStyles(t, s.diagnostics);
|
|
313
283
|
} catch (e) {
|
|
314
284
|
renderCatchError(s, e);
|
|
315
285
|
}
|
|
@@ -320,21 +290,12 @@ function finalizeHydrate(e, t, r, s, n) {
|
|
|
320
290
|
}
|
|
321
291
|
s.title = t.title, r.removeScripts && removeScripts(t.documentElement);
|
|
322
292
|
try {
|
|
323
|
-
(
|
|
324
|
-
let r = e.head.querySelector('link[rel="canonical"]');
|
|
325
|
-
"string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
|
|
326
|
-
e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
|
|
327
|
-
})(t, r.canonicalUrl);
|
|
293
|
+
updateCanonicalLink(t, r.canonicalUrl);
|
|
328
294
|
} catch (e) {
|
|
329
295
|
renderCatchError(s, e);
|
|
330
296
|
}
|
|
331
297
|
try {
|
|
332
|
-
(
|
|
333
|
-
const t = e.head;
|
|
334
|
-
let r = t.querySelector("meta[charset]");
|
|
335
|
-
null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
|
|
336
|
-
t.insertBefore(r, t.firstChild);
|
|
337
|
-
})(t);
|
|
298
|
+
relocateMetaCharset(t);
|
|
338
299
|
} catch (e) {}
|
|
339
300
|
hasError(s.diagnostics) || (s.httpStatus = 200);
|
|
340
301
|
try {
|
|
@@ -385,7 +346,16 @@ import { MockWindow, cloneWindow, patchWindow, constrainTimeouts, serializeNodeT
|
|
|
385
346
|
|
|
386
347
|
import { hydrateFactory } from "@stencil/core/hydrate-factory";
|
|
387
348
|
|
|
388
|
-
const templateWindows = new Map, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)),
|
|
349
|
+
const templateWindows = new Map, isPromise = e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then, hasError = e => null != e && 0 !== e.length && e.some((e => "error" === e.level && "runtime" !== e.type)), TASK_CANCELED_MSG = "task canceled", updateCanonicalLink = (e, t) => {
|
|
350
|
+
let r = e.head.querySelector('link[rel="canonical"]');
|
|
351
|
+
"string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
|
|
352
|
+
e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
|
|
353
|
+
}, relocateMetaCharset = e => {
|
|
354
|
+
const t = e.head;
|
|
355
|
+
let r = t.querySelector("meta[charset]");
|
|
356
|
+
null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
|
|
357
|
+
t.insertBefore(r, t.firstChild);
|
|
358
|
+
}, parseCss = (e, t) => {
|
|
389
359
|
let r = 1, s = 1;
|
|
390
360
|
const n = [], o = e => {
|
|
391
361
|
const t = e.match(/\n/g);
|
|
@@ -732,6 +702,36 @@ const templateWindows = new Map, isPromise = e => !!e && ("object" == typeof e |
|
|
|
732
702
|
}
|
|
733
703
|
if (r) for (let t = 0, s = r.length; t < s; t++) collectUsedSelectors(e, r[t]);
|
|
734
704
|
}
|
|
705
|
+
}, removeUnusedStyles = (e, t) => {
|
|
706
|
+
try {
|
|
707
|
+
const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
|
|
708
|
+
if (s > 0) {
|
|
709
|
+
const n = (e => {
|
|
710
|
+
const t = {
|
|
711
|
+
attrs: new Set,
|
|
712
|
+
classNames: new Set,
|
|
713
|
+
ids: new Set,
|
|
714
|
+
tags: new Set
|
|
715
|
+
};
|
|
716
|
+
return collectUsedSelectors(t, e), t;
|
|
717
|
+
})(e.documentElement);
|
|
718
|
+
for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
|
|
719
|
+
}
|
|
720
|
+
} catch (e) {
|
|
721
|
+
((e, t, r) => {
|
|
722
|
+
const s = {
|
|
723
|
+
level: "error",
|
|
724
|
+
type: "build",
|
|
725
|
+
header: "Build Error",
|
|
726
|
+
messageText: "build error",
|
|
727
|
+
relFilePath: null,
|
|
728
|
+
absFilePath: null,
|
|
729
|
+
lines: []
|
|
730
|
+
};
|
|
731
|
+
null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.length ? t.message : "UNKNOWN ERROR" : s.messageText = t.toString()),
|
|
732
|
+
null == e || (e => e === TASK_CANCELED_MSG)(s.messageText) || e.push(s);
|
|
733
|
+
})(t, e);
|
|
734
|
+
}
|
|
735
735
|
}, removeUnusedStyleText = (e, t, r) => {
|
|
736
736
|
try {
|
|
737
737
|
const s = parseCss(r.innerHTML);
|
package/internal/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.0-dev.20230223211151",
|
|
4
4
|
"description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -222,6 +222,9 @@ export interface StencilConfig {
|
|
|
222
222
|
* is updated, it will not trigger a re-run of tests.
|
|
223
223
|
*/
|
|
224
224
|
watchIgnoredRegex?: RegExp | RegExp[];
|
|
225
|
+
/**
|
|
226
|
+
* Set whether unused dependencies should be excluded from the built output.
|
|
227
|
+
*/
|
|
225
228
|
excludeUnusedDependencies?: boolean;
|
|
226
229
|
stencilCoreResolvedId?: string;
|
|
227
230
|
}
|
|
@@ -913,6 +916,9 @@ export interface CompilerSystem {
|
|
|
913
916
|
*/
|
|
914
917
|
createWorkerController?(maxConcurrentWorkers: number): WorkerMainController;
|
|
915
918
|
encodeToBase64(str: string): string;
|
|
919
|
+
/**
|
|
920
|
+
* @deprecated
|
|
921
|
+
*/
|
|
916
922
|
ensureDependencies?(opts: {
|
|
917
923
|
rootDir: string;
|
|
918
924
|
logger: Logger;
|
|
@@ -921,6 +927,9 @@ export interface CompilerSystem {
|
|
|
921
927
|
stencilPath: string;
|
|
922
928
|
diagnostics: Diagnostic[];
|
|
923
929
|
}>;
|
|
930
|
+
/**
|
|
931
|
+
* @deprecated
|
|
932
|
+
*/
|
|
924
933
|
ensureResources?(opts: {
|
|
925
934
|
rootDir: string;
|
|
926
935
|
logger: Logger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.0.0-dev.20230223211151",
|
|
4
4
|
"description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|