create-esmx 3.0.0-rc.51 → 3.0.0-rc.53

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.
@@ -24,8 +24,7 @@ async function verifyProjectStructure(projectPath, projectName) {
24
24
  "tsconfig.json",
25
25
  "README.md",
26
26
  "src/entry.client.ts",
27
- "src/entry.node.ts",
28
- "src/create-app.ts"
27
+ "src/entry.node.ts"
29
28
  ];
30
29
  for (const file of requiredFiles) {
31
30
  expect(existsSync(join(projectPath, file))).toBe(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-esmx",
3
- "version": "3.0.0-rc.51",
3
+ "version": "3.0.0-rc.53",
4
4
  "description": "A scaffold tool for creating Esmx projects",
5
5
  "type": "module",
6
6
  "private": false,
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "1.9.4",
27
- "@esmx/lint": "3.0.0-rc.51",
27
+ "@esmx/lint": "3.0.0-rc.53",
28
28
  "@types/minimist": "^1.2.5",
29
29
  "@types/node": "^24.0.0",
30
30
  "@vitest/coverage-v8": "3.2.4",
@@ -69,5 +69,5 @@
69
69
  "url": "https://github.com/esmnext/esmx/issues"
70
70
  },
71
71
  "homepage": "https://github.com/esmnext/esmx#readme",
72
- "gitHead": "5556ca6bbaf29a673861c685a19414d5853b9166"
72
+ "gitHead": "e76fe45c0af262d52944c038f04e62b3b0fca3f7"
73
73
  }
@@ -31,8 +31,7 @@ async function verifyProjectStructure(
31
31
  'tsconfig.json',
32
32
  'README.md',
33
33
  'src/entry.client.ts',
34
- 'src/entry.node.ts',
35
- 'src/create-app.ts'
34
+ 'src/entry.node.ts'
36
35
  ];
37
36
 
38
37
  for (const file of requiredFiles) {
@@ -0,0 +1,74 @@
1
+ # {{projectName}}
2
+
3
+ An Esmx project for Shared Packages.
4
+
5
+ ## 📦 Tech Stack
6
+
7
+ - **Framework**: [Esmx](https://esmnext.com) - Next generation micro-frontend framework based on native ESM
8
+ - **Package Type**: Shared Packages
9
+ - **Build Tool**: Rspack
10
+ - **Type Checking**: TypeScript
11
+
12
+ ## 🚀 Quick Start
13
+
14
+ ### Install Dependencies
15
+
16
+ ```bash
17
+ pnpm install
18
+ ```
19
+
20
+ ### Development Environment
21
+
22
+ ```bash
23
+ pnpm dev
24
+ ```
25
+
26
+ Visit http://localhost:3000 to see the development environment.
27
+
28
+ ### Production Build
29
+
30
+ ```bash
31
+ pnpm build
32
+ ```
33
+
34
+ ### Start Production Server
35
+
36
+ ```bash
37
+ pnpm start
38
+ ```
39
+
40
+ ### Type Generation
41
+
42
+ ```bash
43
+ pnpm build:type
44
+ ```
45
+
46
+ ### Type Checking
47
+
48
+ ```bash
49
+ pnpm lint:type
50
+ ```
51
+
52
+ ## 📁 Project Structure
53
+
54
+ ```
55
+ {{projectName}}/
56
+ ├── src/
57
+ │ ├── entry.client.ts # Client-side entry
58
+ │ ├── entry.node.ts # Node.js environment entry point
59
+ │ └── entry.server.ts # Server-side rendering functions
60
+ ├── package.json
61
+ ├── tsconfig.json
62
+ └── README.md
63
+ ```
64
+
65
+ ## 🔧 Configuration Details
66
+
67
+ - `entry.client.ts` - Responsible for client-side interaction and dynamic updates
68
+ - `entry.node.ts` - Handles server-side rendering and development server configuration
69
+ - `entry.server.ts` - Manages server-side rendering process and HTML generation
70
+
71
+ ## 📚 Additional Resources
72
+
73
+ - [Esmx Official Documentation](https://esmnext.com)
74
+ - [TypeScript Documentation](https://www.typescriptlang.org)
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "1.0.0",
4
+ "description": "Shared modules for the project",
5
+ "type": "module",
6
+ "private": true,
7
+ "scripts": {
8
+ "dev": "esmx dev",
9
+ "build": "esmx build",
10
+ "preview": "esmx preview",
11
+ "start": "esmx start",
12
+ "lint:type": "tsc --noEmit",
13
+ "build:type": "tsc --declaration --emitDeclarationOnly --outDir dist/src && tsc-alias -p tsconfig.json --outDir dist/src"
14
+ },
15
+ "dependencies": {
16
+ "@esmx/core": "{{esmxVersion}}",
17
+ "@esmx/router": "{{esmxVersion}}"
18
+ },
19
+ "devDependencies": {
20
+ "tsc-alias": "^1.8.16",
21
+ "@esmx/rspack": "{{esmxVersion}}",
22
+ "@types/node": "^24.0.0",
23
+ "typescript": "5.8.3"
24
+ }
25
+ }
File without changes
@@ -0,0 +1,38 @@
1
+ import http from 'node:http';
2
+ import type { EsmxOptions } from '@esmx/core';
3
+
4
+ export default {
5
+ modules: {
6
+ exports: [
7
+ 'npm:@esmx/router',
8
+ {
9
+ index: {
10
+ input: './src/index.ts'
11
+ }
12
+ }
13
+ ]
14
+ },
15
+ async devApp(esmx) {
16
+ return import('@esmx/rspack').then((m) =>
17
+ m.createRspackHtmlApp(esmx, {
18
+ chain(context) {
19
+ // Custom Rspack configuration
20
+ }
21
+ })
22
+ );
23
+ },
24
+ async server(esmx) {
25
+ const server = http.createServer((req, res) => {
26
+ esmx.middleware(req, res, async () => {
27
+ const rc = await esmx.render({
28
+ params: { url: req.url }
29
+ });
30
+ res.end(rc.html);
31
+ });
32
+ });
33
+
34
+ server.listen(3000, () => {
35
+ console.log('Server started: http://localhost:3000');
36
+ });
37
+ }
38
+ } satisfies EsmxOptions;
@@ -0,0 +1,36 @@
1
+ import type { RenderContext } from '@esmx/core';
2
+
3
+ export default async (rc: RenderContext) => {
4
+ await rc.commit();
5
+
6
+ rc.html = `<!DOCTYPE html>
7
+ <html lang="en">
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <meta name="description" content="Esmx Shared Modules - Micro-frontend module sharing solution based on native ESM">
12
+ <meta name="keywords" content="Esmx,Shared Modules,Micro-frontend,ESM Modules,JavaScript Modules,TypeScript,Rspack,Frontend Architecture">
13
+ <meta name="generator" content="Esmx Framework">
14
+ <link rel="icon" href="https://www.esmnext.com/logo.svg" type="image/svg+xml">
15
+ ${rc.preload()}
16
+ <title>Esmx Shared Modules | Micro-frontend Module Sharing Solution</title>
17
+ ${rc.css()}
18
+ </head>
19
+ <body>
20
+ <header>
21
+ <h1 style="text-align: center;">Esmx Shared Modules</h1>
22
+ <p style="text-align: center;">Micro-frontend module sharing solution based on native ESM</p>
23
+ </header>
24
+ <main>
25
+ <section>
26
+ <h2 style="text-align: center;">Module Features</h2>
27
+ <p style="text-align: center;">Provides common modules and components for cross-application sharing</p>
28
+ </section>
29
+ </main>
30
+ ${rc.importmap()}
31
+ ${rc.moduleEntry()}
32
+ ${rc.modulePreload()}
33
+ </body>
34
+ </html>
35
+ `;
36
+ };
@@ -0,0 +1,3 @@
1
+ export function toFixed(value: number, precision = 2) {
2
+ return value.toFixed(precision);
3
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "ESNext",
4
+ "moduleResolution": "node",
5
+ "isolatedModules": true,
6
+ "resolveJsonModule": true,
7
+
8
+ "target": "ESNext",
9
+ "lib": ["ESNext", "DOM"],
10
+
11
+ "strict": true,
12
+ "skipLibCheck": true,
13
+ "types": ["@types/node"],
14
+
15
+ "experimentalDecorators": true,
16
+ "allowSyntheticDefaultImports": true,
17
+
18
+ "baseUrl": ".",
19
+ "paths": {
20
+ "{{projectName}}/src/*": ["./src/*"],
21
+ "{{projectName}}/*": ["./*"]
22
+ }
23
+ },
24
+ "include": ["src"],
25
+ "exclude": ["dist", "node_modules"]
26
+ }