@stencil/templates 5.0.0-beta.2 → 5.0.0-beta.20

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/README.md CHANGED
@@ -119,7 +119,7 @@ Returns the `module`, `types`, and `type` fields to merge into `package.json` fo
119
119
  import { generatePackageJsonFields } from '@stencil/templates';
120
120
 
121
121
  generatePackageJsonFields([]); // loader-bundle (default)
122
- // { type: 'module', module: './dist/loader-bundle/index.js', types: './dist/types/loader.d.ts' }
122
+ // { type: 'module', module: './dist/loader-bundle/esm/loader.js', types: './dist/types/loader.d.ts' }
123
123
 
124
124
  generatePackageJsonFields(['standalone']);
125
125
  // { type: 'module', module: './dist/standalone/index.js', types: './dist/types/standalone.d.ts' }
package/dist/index.d.mts CHANGED
@@ -19,6 +19,19 @@ declare function toPascalCase(str: string): string;
19
19
  */
20
20
  declare function getComponentBoilerplate(tagName: string, styleExtension?: string): string;
21
21
  //#endregion
22
+ //#region src/generate/css-component.d.ts
23
+ /**
24
+ * Returns the CSS-only component boilerplate for `stencil generate` - a documented tag
25
+ * definition with no backing JS class, no shadow root, and no `customElements.define()`.
26
+ * See `packages/core/src/compiler/css-components/`.
27
+ * SASS indented syntax uses indentation instead of braces.
28
+ *
29
+ * @param tagName - Dash-case custom element tag name.
30
+ * @param ext - File extension (e.g. `'css'`, `'scss'`, `'sass'`, `'less'`). Defaults to `'css'`.
31
+ * @returns Stylesheet source string for the new CSS-only component file.
32
+ */
33
+ declare function getCssOnlyComponentBoilerplate(tagName: string, ext?: string): string;
34
+ //#endregion
22
35
  //#region src/generate/style.d.ts
23
36
  /**
24
37
  * Returns the stylesheet boilerplate for `stencil generate`.
@@ -53,11 +66,13 @@ interface ConfigSelections {
53
66
  namespace: string;
54
67
  outputs: ReadonlyArray<OutputKey>;
55
68
  signals: boolean;
69
+ /** Write an `exports` map into `package.json` on each production build. */
70
+ exportMaps?: boolean;
56
71
  docs: ReadonlyArray<DocKey>;
57
72
  }
58
73
  /**
59
74
  * Returns stencil.config.ts source for the given selections, or null if zero-config
60
- * covers everything (outputs = [] | ['loader'], no signals, no docs).
75
+ * covers everything (outputs = [] | ['loader'], no signals, no export maps, no docs).
61
76
  *
62
77
  * @param sel - Wizard selections to encode into the config file.
63
78
  * @returns TypeScript source string, or null if no config file is needed.
@@ -110,4 +125,4 @@ declare function getUsageExampleBoilerplate(tagName: string): string;
110
125
  */
111
126
  declare function getPreviewHtmlBoilerplate(tagName: string, entryScriptSrc: string | null): string;
112
127
  //#endregion
113
- export { type ConfigSelections, type DocKey, type IndexHtmlSelections, type OutputKey, PROJECT_TEMPLATES, type PackageJsonFields, type ProjectTemplateId, type StyleExtension, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
128
+ export { type ConfigSelections, type DocKey, type IndexHtmlSelections, type OutputKey, PROJECT_TEMPLATES, type PackageJsonFields, type ProjectTemplateId, type StyleExtension, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getCssOnlyComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
package/dist/index.mjs CHANGED
@@ -39,6 +39,33 @@ export class ${toPascalCase(tagName)} {
39
39
  `;
40
40
  }
41
41
  //#endregion
42
+ //#region src/generate/css-component.ts
43
+ /**
44
+ * Returns the CSS-only component boilerplate for `stencil generate` - a documented tag
45
+ * definition with no backing JS class, no shadow root, and no `customElements.define()`.
46
+ * See `packages/core/src/compiler/css-components/`.
47
+ * SASS indented syntax uses indentation instead of braces.
48
+ *
49
+ * @param tagName - Dash-case custom element tag name.
50
+ * @param ext - File extension (e.g. `'css'`, `'scss'`, `'sass'`, `'less'`). Defaults to `'css'`.
51
+ * @returns Stylesheet source string for the new CSS-only component file.
52
+ */
53
+ function getCssOnlyComponentBoilerplate(tagName, ext = "css") {
54
+ if (ext === "sass") return `/**
55
+ * @component
56
+ */
57
+ ${tagName}
58
+ display: block
59
+ `;
60
+ return `/**
61
+ * @component
62
+ */
63
+ ${tagName} {
64
+ display: block;
65
+ }
66
+ `;
67
+ }
68
+ //#endregion
42
69
  //#region src/generate/style.ts
43
70
  /**
44
71
  * Returns the stylesheet boilerplate for `stencil generate`.
@@ -68,15 +95,15 @@ function getTemplatePath(templateId) {
68
95
  //#region src/project/config.ts
69
96
  /**
70
97
  * Returns stencil.config.ts source for the given selections, or null if zero-config
71
- * covers everything (outputs = [] | ['loader'], no signals, no docs).
98
+ * covers everything (outputs = [] | ['loader'], no signals, no export maps, no docs).
72
99
  *
73
100
  * @param sel - Wizard selections to encode into the config file.
74
101
  * @returns TypeScript source string, or null if no config file is needed.
75
102
  */
76
103
  function generateStencilConfig(sel) {
77
- if ((sel.outputs.length === 0 || sel.outputs.length === 1 && sel.outputs[0] === "loader") && !sel.signals && sel.docs.length === 0) return null;
104
+ if ((sel.outputs.length === 0 || sel.outputs.length === 1 && sel.outputs[0] === "loader") && !sel.signals && !sel.exportMaps && sel.docs.length === 0) return null;
78
105
  const outputLines = [];
79
- if (sel.outputs.includes("loader") || sel.outputs.length === 0) outputLines.push(` { type: 'loader-bundle' },`);
106
+ if (sel.outputs.includes("loader")) outputLines.push(` { type: 'loader-bundle' },`);
80
107
  if (sel.outputs.includes("standalone")) outputLines.push(` { type: 'standalone' },`);
81
108
  if (sel.outputs.includes("ssr")) outputLines.push(` { type: 'ssr' },`);
82
109
  if (sel.outputs.includes("ssr-wasm")) outputLines.push(` { type: 'ssr-wasm' },`);
@@ -97,6 +124,7 @@ function generateStencilConfig(sel) {
97
124
  parts.push(` ],`);
98
125
  }
99
126
  if (sel.signals) parts.push(` signalBacking: true,`);
127
+ if (sel.exportMaps) parts.push(` generateExportMaps: true,`);
100
128
  parts.push(`};`);
101
129
  parts.push(``);
102
130
  return parts.join("\n");
@@ -113,7 +141,7 @@ function generatePackageJsonFields(outputs) {
113
141
  const has = (key) => outputs.includes(key);
114
142
  if (isDefault || has("loader")) return {
115
143
  type: "module",
116
- module: "./dist/loader-bundle/index.js",
144
+ module: "./dist/loader-bundle/esm/loader.js",
117
145
  types: "./dist/types/loader.d.ts"
118
146
  };
119
147
  if (has("standalone")) return {
@@ -208,4 +236,4 @@ ${entryScriptSrc ? ` <script type="module" src="${entryScriptSrc}"><\/script>
208
236
  `;
209
237
  }
210
238
  //#endregion
211
- export { PROJECT_TEMPLATES, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
239
+ export { PROJECT_TEMPLATES, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getCssOnlyComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/templates",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.20",
4
4
  "description": "Project and generate templates for Stencil",
5
5
  "keywords": [
6
6
  "scaffolding",
@@ -33,7 +33,10 @@
33
33
  "vitest": "^4.1.10"
34
34
  },
35
35
  "peerDependencies": {
36
- "@stencil/core": "^5.0.0 || 5.0.0-beta.2"
36
+ "@stencil/core": "^5.0.0 || 5.0.0-beta.20"
37
+ },
38
+ "engines": {
39
+ "node": ">=22.0.0"
37
40
  },
38
41
  "volta": {
39
42
  "extends": "../../package.json"
@@ -1,6 +0,0 @@
1
- import type { Config } from '@stencil/core';
2
-
3
- export const config: Config = {
4
- namespace: '{{NAMESPACE}}',
5
- outputTargets: [{ type: 'loader-bundle' }, { type: 'types' }],
6
- };