@stencil/core 5.0.0-beta.0 → 5.0.0-beta.1

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.
@@ -1,6 +1,6 @@
1
1
  import nodePath from "node:path";
2
2
  import { MockWindow, setupGlobal } from "@stencil/mock-doc";
3
- import ts from "typescript";
3
+ import "typescript";
4
4
  import fs from "node:fs";
5
5
  import "picomatch";
6
6
  import { effect, effect as effect$1, signal } from "@preact/signals-core";
@@ -11,6 +11,7 @@ import "postcss-selector-parser";
11
11
  import "magic-string";
12
12
  import "rolldown";
13
13
  import resolve from "resolve";
14
+ import "rolldown/utils";
14
15
  import "terser";
15
16
  import "css-what";
16
17
  import { execFile } from "node:child_process";
@@ -31,7 +32,7 @@ import "@rollup/pluginutils";
31
32
  import { createHash } from "crypto";
32
33
  import { afterAll, vi } from "vitest";
33
34
  //#region src/version.ts
34
- const version = "5.0.0-beta.0";
35
+ const version = "5.0.0-beta.1";
35
36
  const MEMBER_FLAGS = {
36
37
  String: 1,
37
38
  Number: 2,
@@ -378,10 +379,6 @@ const trimFalsy = (data) => {
378
379
  */
379
380
  const isDef = (v) => v != null && v !== void 0;
380
381
  /**
381
- * This is just a no-op, don't expect it to do anything.
382
- */
383
- const noop = () => {};
384
- /**
385
382
  * Check whether a value is a 'complex type', defined here as an object or a
386
383
  * function.
387
384
  *
@@ -534,23 +531,6 @@ function join(...paths) {
534
531
  */
535
532
  return normalizePath(nodePath.join(...paths), false);
536
533
  }
537
- /**
538
- * A wrapped version of node.js' {@link path.resolve} which adds our custom
539
- * normalization logic. This resolves a path to a given (relative or absolute)
540
- * path.
541
- *
542
- * @throws the underlying node function will throw if any argument is not a
543
- * string
544
- * @param paths a path or path fragments to resolve
545
- * @returns a resolved path!
546
- */
547
- function resolve$1(...paths) {
548
- /**
549
- * When normalizing, we should _not_ attempt to relativize the path returned by the native Node `resolve` method. When
550
- * calculating the path from each of the string-based parts, Node does not prepend './' to the calculated path.
551
- */
552
- return normalizePath(nodePath.resolve(...paths), false);
553
- }
554
534
  //#endregion
555
535
  //#region src/utils/query-nonce-meta-tag-content.ts
556
536
  /**
@@ -4116,12 +4096,13 @@ const restoreSafeSelector = (placeholders, content) => {
4116
4096
  const _polyfillHost = "-shadowcsshost";
4117
4097
  const _polyfillSlotted = "-shadowcssslotted";
4118
4098
  const _polyfillHostContext = "-shadowcsscontext";
4099
+ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
4119
4100
  let _cssColonHostRe;
4120
4101
  let _cssColonHostContextRe;
4121
4102
  let _cssColonSlottedRe;
4122
- const getCssColonHostRe = () => _cssColonHostRe ??= /* @__PURE__ */ new RegExp("(-shadowcsshost)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
4123
- const getCssColonHostContextRe = () => _cssColonHostContextRe ??= /* @__PURE__ */ new RegExp("(-shadowcsscontext)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
4124
- const getCssColonSlottedRe = () => _cssColonSlottedRe ??= /* @__PURE__ */ new RegExp("(-shadowcssslotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
4103
+ const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
4104
+ const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
4105
+ const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
4125
4106
  const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
4126
4107
  const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
4127
4108
  const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
@@ -4686,6 +4667,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4686
4667
  //#endregion
4687
4668
  //#region src/runtime/proxy-component.ts
4688
4669
  /**
4670
+ * Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
4671
+ * recognize an `attributeChangedCallback` it triggered itself.
4672
+ *
4673
+ * @param propValue the current value of a reflected prop
4674
+ * @returns the string the attribute would hold, or `null` if the attribute would be removed
4675
+ */
4676
+ const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4677
+ /**
4689
4678
  * Attach a series of runtime constructs to a compiled Stencil component
4690
4679
  * constructor, including getters and setters for the `@Prop` and `@State`
4691
4680
  * decorators, callbacks for when attributes change, and so on.
@@ -4833,7 +4822,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4833
4822
  return;
4834
4823
  }
4835
4824
  const propFlags = members.find(([m]) => m === propName);
4836
- const isBooleanTarget = propFlags && propFlags[1][0] & MEMBER_FLAGS.Boolean;
4825
+ const propMemberFlags = propFlags ? propFlags[1][0] : 0;
4826
+ const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4827
+ if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4837
4828
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4838
4829
  if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4839
4830
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
@@ -5863,28 +5854,6 @@ new RegExp(`^(${[.../* @__PURE__ */ new Set([
5863
5854
  ])].join("|")})$`);
5864
5855
  promisify(execFile);
5865
5856
  process.platform;
5866
- //#endregion
5867
- //#region src/compiler/sys/typescript/typescript-sys.ts
5868
- const patchTypeScriptSysMinimum = () => {
5869
- if (!ts.sys) ts.sys = {
5870
- args: [],
5871
- createDirectory: noop,
5872
- directoryExists: () => false,
5873
- exit: noop,
5874
- fileExists: () => false,
5875
- getCurrentDirectory: process.cwd,
5876
- getDirectories: () => [],
5877
- getExecutingFilePath: () => "./",
5878
- readDirectory: () => [],
5879
- readFile: noop,
5880
- newLine: "\n",
5881
- resolvePath: resolve$1,
5882
- useCaseSensitiveFileNames: false,
5883
- write: noop,
5884
- writeFile: noop
5885
- };
5886
- };
5887
- patchTypeScriptSysMinimum();
5888
5857
  new Set([
5889
5858
  "CheckboxStateChange",
5890
5859
  "DOMContentLoaded",
@@ -7764,6 +7733,7 @@ function mockValidatedConfig(overrides = {}) {
7764
7733
  logger: mockLogger(),
7765
7734
  minifyCss: false,
7766
7735
  minifyJs: false,
7736
+ jsMinifier: "oxc",
7767
7737
  namespace: "Testing",
7768
7738
  outputTargets: baseConfig.outputTargets ?? [],
7769
7739
  packageJsonFilePath: nodePath.join(rootDir, "package.json"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.0",
3
+ "version": "5.0.0-beta.1",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -43,6 +43,10 @@
43
43
  "types": "./dist/compiler/utils/index.d.mts",
44
44
  "import": "./dist/compiler/utils/index.mjs"
45
45
  },
46
+ "./compiler/browser": {
47
+ "types": "./dist/compiler/browser.d.ts",
48
+ "import": "./dist/compiler/browser.js"
49
+ },
46
50
  "./jsx-runtime": {
47
51
  "types": "./dist/jsx-runtime.d.mts",
48
52
  "import": "./dist/jsx-runtime.mjs"
@@ -116,14 +120,14 @@
116
120
  "postcss-safe-parser": "^7.0.1",
117
121
  "postcss-selector-parser": "^7.1.5",
118
122
  "resolve": "^1.22.12",
119
- "rolldown": "^1.2.4",
123
+ "rolldown": "^1.2.6",
120
124
  "semver": "^7.8.5",
121
125
  "terser": "^5.50.0",
122
126
  "tinyglobby": "^0.2.17",
123
127
  "typescript": ">5.0.0 <7.0.0",
124
- "@stencil/cli": "5.0.0-beta.0",
125
- "@stencil/dev-server": "5.0.0-beta.0",
126
- "@stencil/mock-doc": "5.0.0-beta.0"
128
+ "@stencil/cli": "5.0.0-beta.1",
129
+ "@stencil/mock-doc": "5.0.0-beta.1",
130
+ "@stencil/dev-server": "5.0.0-beta.1"
127
131
  },
128
132
  "devDependencies": {
129
133
  "@ionic/prettier-config": "^4.0.0",