@stencil/core 5.0.0-beta.20 → 5.0.0-beta.21

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.
@@ -1844,7 +1844,7 @@ const validateComponentTag = (tag) => {
1844
1844
  };
1845
1845
  //#endregion
1846
1846
  //#region src/version.ts
1847
- const version = "5.0.0-beta.20";
1847
+ const version = "5.0.0-beta.21";
1848
1848
  //#endregion
1849
1849
  //#region src/compiler/events.ts
1850
1850
  const buildEvents = () => {
@@ -15440,13 +15440,13 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
15440
15440
  hasPatchClone: false,
15441
15441
  hasPatchInsert: false
15442
15442
  };
15443
- const visitComponentChildNode = (node, ctx) => {
15444
- validateComponentMembers(node, ctx);
15443
+ if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
15444
+ const visitComponentChildNode = (node) => {
15445
15445
  if (ts$1.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
15446
15446
  else if (ts$1.isStringLiteral(node)) parseStringLiteral(cmp, node);
15447
- node.forEachChild((child) => visitComponentChildNode(child, ctx));
15447
+ node.forEachChild(visitComponentChildNode);
15448
15448
  };
15449
- visitComponentChildNode(cmpNode, buildCtx);
15449
+ visitComponentChildNode(cmpNode);
15450
15450
  parseClassMethods(classMethods, cmp);
15451
15451
  cmp.hasModernPropertyDecls = detectModernPropDeclarations(cmpNode) || doesExtend;
15452
15452
  cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
@@ -15464,31 +15464,32 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
15464
15464
  return cmpNode;
15465
15465
  };
15466
15466
  /**
15467
- * Check whether a class declaration is a Stencil component, i.e. it's
15468
- * decorated with `@Component({ tag: ... })`.
15469
- * @param classNode the class declaration to check
15470
- * @returns whether `classNode` is a Stencil component class
15467
+ * Warn about members a Stencil component class should not define.
15468
+ * @param cmpNode the component class declaration
15469
+ * @param buildCtx the current build context, used to surface diagnostics
15471
15470
  */
15472
- const isStencilComponentClass = (classNode) => {
15473
- const decorator = ts$1.getDecorators(classNode)?.[0];
15474
- return decorator != null && ts$1.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && ts$1.isObjectLiteralExpression(decorator.expression.arguments[0]) && decorator.expression.arguments[0].properties.some((prop) => ts$1.isPropertyAssignment(prop) && prop.name.getText() === "tag");
15475
- };
15476
- const validateComponentMembers = (node, buildCtx) => {
15477
- /**
15478
- * validate if:
15479
- */
15480
- if (ts$1.isGetAccessorDeclaration(node) && ts$1.isIdentifier(node.name) && typeof node.name.escapedText === "string" && BLACKLISTED_COMPONENT_METHODS.includes(node.name.escapedText) && node.parent && ts$1.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
15481
- const propName = node.name.escapedText;
15482
- const componentName = node.parent.name.getText();
15483
- const err = buildWarn(buildCtx.diagnostics);
15484
- err.messageText = `The component "${componentName}" has a getter called "${propName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
15485
- augmentDiagnosticWithNode(err, node);
15486
- }
15487
- if (ts$1.isMethodDeclaration(node) && ts$1.isIdentifier(node.name) && node.name.escapedText === "componentShouldUpdate" && node.parameters.length > 1 && node.parent && ts$1.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
15488
- const componentName = node.parent.name.getText();
15489
- const err = buildWarn(buildCtx.diagnostics);
15490
- err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${node.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
15491
- augmentDiagnosticWithNode(err, node);
15471
+ const validateComponentMembers = (cmpNode, buildCtx) => {
15472
+ const componentName = cmpNode.name?.text ?? "";
15473
+ for (const member of cmpNode.members) {
15474
+ if (!member.name || !ts$1.isIdentifier(member.name)) continue;
15475
+ const memberName = member.name.text;
15476
+ /**
15477
+ * the component has a getter called "shadowRoot"
15478
+ */
15479
+ if (ts$1.isGetAccessorDeclaration(member) && BLACKLISTED_COMPONENT_METHODS.includes(memberName)) {
15480
+ const err = buildWarn(buildCtx.diagnostics);
15481
+ err.messageText = `The component "${componentName}" has a getter called "${memberName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
15482
+ augmentDiagnosticWithNode(err, ts$1.getOriginalNode(member));
15483
+ }
15484
+ /**
15485
+ * the component defines a "componentShouldUpdate" method with more than one parameter,
15486
+ * which was the pre-v5 per-prop signature "(newVal, oldVal, propName)"
15487
+ */
15488
+ if (ts$1.isMethodDeclaration(member) && memberName === "componentShouldUpdate" && member.parameters.length > 1) {
15489
+ const err = buildWarn(buildCtx.diagnostics);
15490
+ err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${member.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
15491
+ augmentDiagnosticWithNode(err, ts$1.getOriginalNode(member));
15492
+ }
15492
15493
  }
15493
15494
  };
15494
15495
  const parseVirtualProps = (docs) => {
@@ -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-CUsOl_Kw.mjs";
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-ApS_Tn_4.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bz2SOK7_.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-beta.20";
465
- const buildId = "1791812865";
466
- const vermoji = "🚕";
464
+ const version = "5.0.0-beta.21";
465
+ const buildId = "1791840744";
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.
@@ -12778,11 +12778,9 @@ const generateSsrFactory = async (config, compilerCtx, buildCtx) => {
12778
12778
  format: "cjs",
12779
12779
  esModule: false,
12780
12780
  strict: false,
12781
- intro: SSR_FACTORY_INTRO,
12782
- outro: SSR_FACTORY_OUTRO,
12783
12781
  codeSplitting: false
12784
12782
  });
12785
- if (!buildCtx.hasError && rolldownOutput != null && Array.isArray(rolldownOutput.output)) return rolldownOutput.output[0].code;
12783
+ if (!buildCtx.hasError && rolldownOutput != null && Array.isArray(rolldownOutput.output)) return SSR_FACTORY_INTRO + rolldownOutput.output[0].code + SSR_FACTORY_OUTRO;
12786
12784
  }
12787
12785
  } catch (e) {
12788
12786
  catchError(buildCtx.diagnostics, e);
@@ -18174,13 +18172,13 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18174
18172
  hasPatchClone: false,
18175
18173
  hasPatchInsert: false
18176
18174
  };
18177
- const visitComponentChildNode = (node, ctx) => {
18178
- validateComponentMembers(node, ctx);
18175
+ if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
18176
+ const visitComponentChildNode = (node) => {
18179
18177
  if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
18180
18178
  else if (ts.isStringLiteral(node)) parseStringLiteral(cmp, node);
18181
- node.forEachChild((child) => visitComponentChildNode(child, ctx));
18179
+ node.forEachChild(visitComponentChildNode);
18182
18180
  };
18183
- visitComponentChildNode(cmpNode, buildCtx);
18181
+ visitComponentChildNode(cmpNode);
18184
18182
  parseClassMethods(classMethods, cmp);
18185
18183
  cmp.hasModernPropertyDecls = detectModernPropDeclarations(cmpNode) || doesExtend;
18186
18184
  cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
@@ -18198,31 +18196,32 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18198
18196
  return cmpNode;
18199
18197
  };
18200
18198
  /**
18201
- * Check whether a class declaration is a Stencil component, i.e. it's
18202
- * decorated with `@Component({ tag: ... })`.
18203
- * @param classNode the class declaration to check
18204
- * @returns whether `classNode` is a Stencil component class
18199
+ * Warn about members a Stencil component class should not define.
18200
+ * @param cmpNode the component class declaration
18201
+ * @param buildCtx the current build context, used to surface diagnostics
18205
18202
  */
18206
- const isStencilComponentClass = (classNode) => {
18207
- const decorator = ts.getDecorators(classNode)?.[0];
18208
- return decorator != null && ts.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && ts.isObjectLiteralExpression(decorator.expression.arguments[0]) && decorator.expression.arguments[0].properties.some((prop) => ts.isPropertyAssignment(prop) && prop.name.getText() === "tag");
18209
- };
18210
- const validateComponentMembers = (node, buildCtx) => {
18211
- /**
18212
- * validate if:
18213
- */
18214
- if (ts.isGetAccessorDeclaration(node) && ts.isIdentifier(node.name) && typeof node.name.escapedText === "string" && BLACKLISTED_COMPONENT_METHODS.includes(node.name.escapedText) && node.parent && ts.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
18215
- const propName = node.name.escapedText;
18216
- const componentName = node.parent.name.getText();
18217
- const err = buildWarn(buildCtx.diagnostics);
18218
- err.messageText = `The component "${componentName}" has a getter called "${propName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
18219
- augmentDiagnosticWithNode(err, node);
18220
- }
18221
- if (ts.isMethodDeclaration(node) && ts.isIdentifier(node.name) && node.name.escapedText === "componentShouldUpdate" && node.parameters.length > 1 && node.parent && ts.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
18222
- const componentName = node.parent.name.getText();
18223
- const err = buildWarn(buildCtx.diagnostics);
18224
- err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${node.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
18225
- augmentDiagnosticWithNode(err, node);
18203
+ const validateComponentMembers = (cmpNode, buildCtx) => {
18204
+ const componentName = cmpNode.name?.text ?? "";
18205
+ for (const member of cmpNode.members) {
18206
+ if (!member.name || !ts.isIdentifier(member.name)) continue;
18207
+ const memberName = member.name.text;
18208
+ /**
18209
+ * the component has a getter called "shadowRoot"
18210
+ */
18211
+ if (ts.isGetAccessorDeclaration(member) && BLACKLISTED_COMPONENT_METHODS.includes(memberName)) {
18212
+ const err = buildWarn(buildCtx.diagnostics);
18213
+ err.messageText = `The component "${componentName}" has a getter called "${memberName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
18214
+ augmentDiagnosticWithNode(err, ts.getOriginalNode(member));
18215
+ }
18216
+ /**
18217
+ * the component defines a "componentShouldUpdate" method with more than one parameter,
18218
+ * which was the pre-v5 per-prop signature "(newVal, oldVal, propName)"
18219
+ */
18220
+ if (ts.isMethodDeclaration(member) && memberName === "componentShouldUpdate" && member.parameters.length > 1) {
18221
+ const err = buildWarn(buildCtx.diagnostics);
18222
+ err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${member.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
18223
+ augmentDiagnosticWithNode(err, ts.getOriginalNode(member));
18224
+ }
18226
18225
  }
18227
18226
  };
18228
18227
  const parseVirtualProps = (docs) => {
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-CUsOl_Kw.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-ApS_Tn_4.mjs";
2
2
  import { t as createNodeSys } from "../../node-Bz2SOK7_.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-beta.20";
36
+ const version = "5.0.0-beta.21";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.20",
3
+ "version": "5.0.0-beta.21",
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-beta.20",
130
- "@stencil/mock-doc": "5.0.0-beta.20",
131
- "@stencil/dev-server": "5.0.0-beta.20"
129
+ "@stencil/cli": "5.0.0-beta.21",
130
+ "@stencil/mock-doc": "5.0.0-beta.21",
131
+ "@stencil/dev-server": "5.0.0-beta.21"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",