create-rslib 0.0.15 → 0.0.17

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.
Files changed (112) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +140 -8
  3. package/package.json +10 -7
  4. package/{template-node-dual-js → template-[node-dual]-[]-js}/rslib.config.mjs +0 -1
  5. package/template-[node-dual]-[]-js/src/index.js +1 -0
  6. package/{template-node-dual-ts → template-[node-dual]-[]-ts}/package.json +1 -0
  7. package/{template-node-dual-ts → template-[node-dual]-[]-ts}/rslib.config.ts +0 -1
  8. package/template-[node-dual]-[]-ts/src/index.ts +1 -0
  9. package/{template-node-dual-ts → template-[node-dual]-[]-ts}/tsconfig.json +1 -2
  10. package/template-[node-dual]-[vitest]-js/package.json +25 -0
  11. package/template-[node-dual]-[vitest]-js/rslib.config.mjs +14 -0
  12. package/template-[node-dual]-[vitest]-js/src/index.js +1 -0
  13. package/template-[node-dual]-[vitest]-js/tests/index.test.js +7 -0
  14. package/template-[node-dual]-[vitest]-js/vitest.config.js +8 -0
  15. package/template-[node-dual]-[vitest]-ts/package.json +29 -0
  16. package/template-[node-dual]-[vitest]-ts/rslib.config.ts +15 -0
  17. package/template-[node-dual]-[vitest]-ts/src/index.ts +1 -0
  18. package/template-[node-dual]-[vitest]-ts/tests/index.test.ts +7 -0
  19. package/{template-node-esm-ts → template-[node-dual]-[vitest]-ts}/tsconfig.json +1 -2
  20. package/template-[node-dual]-[vitest]-ts/vitest.config.ts +6 -0
  21. package/{template-node-esm-js → template-[node-esm]-[]-js}/rslib.config.mjs +0 -1
  22. package/template-[node-esm]-[]-js/src/index.js +1 -0
  23. package/{template-node-esm-ts → template-[node-esm]-[]-ts}/package.json +1 -0
  24. package/{template-node-esm-ts → template-[node-esm]-[]-ts}/rslib.config.ts +0 -1
  25. package/template-[node-esm]-[]-ts/src/index.ts +1 -0
  26. package/template-[node-esm]-[]-ts/tsconfig.json +15 -0
  27. package/template-[node-esm]-[vitest]-js/package.json +23 -0
  28. package/template-[node-esm]-[vitest]-js/rslib.config.mjs +10 -0
  29. package/template-[node-esm]-[vitest]-js/src/index.js +1 -0
  30. package/template-[node-esm]-[vitest]-js/tests/index.test.js +7 -0
  31. package/template-[node-esm]-[vitest]-js/vitest.config.js +8 -0
  32. package/template-[node-esm]-[vitest]-ts/package.json +27 -0
  33. package/template-[node-esm]-[vitest]-ts/rslib.config.ts +11 -0
  34. package/template-[node-esm]-[vitest]-ts/src/index.ts +1 -0
  35. package/template-[node-esm]-[vitest]-ts/tests/index.test.ts +7 -0
  36. package/template-[node-esm]-[vitest]-ts/tsconfig.json +15 -0
  37. package/template-[node-esm]-[vitest]-ts/vitest.config.ts +6 -0
  38. package/template-[react]-[]-js/package.json +27 -0
  39. package/template-[react]-[]-js/rslib.config.mjs +26 -0
  40. package/template-[react]-[]-js/src/Button.jsx +22 -0
  41. package/template-[react]-[]-js/src/button.css +34 -0
  42. package/template-[react]-[]-js/src/index.jsx +1 -0
  43. package/template-[react]-[]-ts/package.json +31 -0
  44. package/template-[react]-[]-ts/rslib.config.ts +27 -0
  45. package/template-[react]-[]-ts/src/Button.tsx +30 -0
  46. package/template-[react]-[]-ts/src/button.css +34 -0
  47. package/template-[react]-[]-ts/src/index.tsx +1 -0
  48. package/template-[react]-[]-ts/tsconfig.json +14 -0
  49. package/template-[react]-[storybook,vitest]-js/.storybook/main.js +36 -0
  50. package/template-[react]-[storybook,vitest]-js/.storybook/preview.js +12 -0
  51. package/template-[react]-[storybook,vitest]-js/package.json +45 -0
  52. package/template-[react]-[storybook,vitest]-js/rslib.config.mjs +26 -0
  53. package/template-[react]-[storybook,vitest]-js/src/Button.jsx +22 -0
  54. package/template-[react]-[storybook,vitest]-js/src/button.css +34 -0
  55. package/template-[react]-[storybook,vitest]-js/src/index.jsx +1 -0
  56. package/template-[react]-[storybook,vitest]-js/stories/Button.stories.jsx +50 -0
  57. package/template-[react]-[storybook,vitest]-js/tests/index.test.jsx +12 -0
  58. package/template-[react]-[storybook,vitest]-js/vitest.config.js +11 -0
  59. package/template-[react]-[storybook,vitest]-js/vitest.setup.js +1 -0
  60. package/template-[react]-[storybook,vitest]-ts/.storybook/main.ts +37 -0
  61. package/template-[react]-[storybook,vitest]-ts/.storybook/preview.ts +14 -0
  62. package/template-[react]-[storybook,vitest]-ts/package.json +49 -0
  63. package/template-[react]-[storybook,vitest]-ts/rslib.config.ts +27 -0
  64. package/template-[react]-[storybook,vitest]-ts/src/Button.tsx +30 -0
  65. package/template-[react]-[storybook,vitest]-ts/src/button.css +34 -0
  66. package/template-[react]-[storybook,vitest]-ts/src/index.tsx +1 -0
  67. package/template-[react]-[storybook,vitest]-ts/stories/Button.stories.ts +52 -0
  68. package/template-[react]-[storybook,vitest]-ts/tests/index.test.tsx +12 -0
  69. package/template-[react]-[storybook,vitest]-ts/tsconfig.json +14 -0
  70. package/template-[react]-[storybook,vitest]-ts/vitest.config.ts +9 -0
  71. package/template-[react]-[storybook,vitest]-ts/vitest.setup.ts +1 -0
  72. package/template-[react]-[storybook]-js/.storybook/main.js +36 -0
  73. package/template-[react]-[storybook]-js/.storybook/preview.js +12 -0
  74. package/template-[react]-[storybook]-js/package.json +40 -0
  75. package/template-[react]-[storybook]-js/rslib.config.mjs +26 -0
  76. package/template-[react]-[storybook]-js/src/Button.jsx +22 -0
  77. package/template-[react]-[storybook]-js/src/button.css +34 -0
  78. package/template-[react]-[storybook]-js/src/index.jsx +1 -0
  79. package/template-[react]-[storybook]-js/stories/Button.stories.jsx +50 -0
  80. package/template-[react]-[storybook]-ts/.storybook/main.ts +37 -0
  81. package/template-[react]-[storybook]-ts/.storybook/preview.ts +14 -0
  82. package/template-[react]-[storybook]-ts/package.json +44 -0
  83. package/template-[react]-[storybook]-ts/rslib.config.ts +27 -0
  84. package/template-[react]-[storybook]-ts/src/Button.tsx +30 -0
  85. package/template-[react]-[storybook]-ts/src/button.css +34 -0
  86. package/template-[react]-[storybook]-ts/src/index.tsx +1 -0
  87. package/template-[react]-[storybook]-ts/stories/Button.stories.ts +52 -0
  88. package/template-[react]-[storybook]-ts/tsconfig.json +14 -0
  89. package/template-[react]-[vitest]-js/package.json +32 -0
  90. package/template-[react]-[vitest]-js/rslib.config.mjs +26 -0
  91. package/template-[react]-[vitest]-js/src/Button.jsx +22 -0
  92. package/template-[react]-[vitest]-js/src/button.css +34 -0
  93. package/template-[react]-[vitest]-js/src/index.jsx +1 -0
  94. package/template-[react]-[vitest]-js/tests/index.test.jsx +12 -0
  95. package/template-[react]-[vitest]-js/vitest.config.js +11 -0
  96. package/template-[react]-[vitest]-js/vitest.setup.js +1 -0
  97. package/template-[react]-[vitest]-ts/package.json +36 -0
  98. package/template-[react]-[vitest]-ts/rslib.config.ts +27 -0
  99. package/template-[react]-[vitest]-ts/src/Button.tsx +30 -0
  100. package/template-[react]-[vitest]-ts/src/button.css +34 -0
  101. package/template-[react]-[vitest]-ts/src/index.tsx +1 -0
  102. package/template-[react]-[vitest]-ts/tests/index.test.tsx +12 -0
  103. package/template-[react]-[vitest]-ts/tsconfig.json +14 -0
  104. package/template-[react]-[vitest]-ts/vitest.config.ts +9 -0
  105. package/template-[react]-[vitest]-ts/vitest.setup.ts +1 -0
  106. package/template-common/README.md +1 -1
  107. package/template-node-dual-js/src/index.js +0 -3
  108. package/template-node-dual-ts/src/index.ts +0 -3
  109. package/template-node-esm-js/src/index.js +0 -3
  110. package/template-node-esm-ts/src/index.ts +0 -3
  111. /package/{template-node-dual-js → template-[node-dual]-[]-js}/package.json +0 -0
  112. /package/{template-node-esm-js → template-[node-esm]-[]-js}/package.json +0 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Rslib
6
6
 
7
- Rslib is a library build tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
7
+ Rslib is a library development tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
8
8
 
9
9
  ## Documentation
10
10
 
package/dist/index.js CHANGED
@@ -1,6 +1,113 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_create_rstack__ from "create-rstack";
4
+ import "node:fs";
5
+ const helpers_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url);
6
+ const helpers_dirname = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname(helpers_filename);
7
+ __WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(helpers_dirname, '../fragments');
8
+ const composeTemplateName = ({ template, tools, lang })=>`[${template}]-[${(tools ? Object.keys(tools) : []).sort()}]-${lang}`;
9
+ const TEMPLATES = [
10
+ // node-dual
11
+ {
12
+ template: 'node-dual',
13
+ lang: 'js'
14
+ },
15
+ {
16
+ template: 'node-dual',
17
+ lang: 'ts'
18
+ },
19
+ {
20
+ template: 'node-dual',
21
+ lang: 'js',
22
+ tools: {
23
+ vitest: 'vitest-node-js'
24
+ }
25
+ },
26
+ {
27
+ template: 'node-dual',
28
+ lang: 'ts',
29
+ tools: {
30
+ vitest: 'vitest-node-ts'
31
+ }
32
+ },
33
+ // node-esm
34
+ {
35
+ template: 'node-esm',
36
+ lang: 'js'
37
+ },
38
+ {
39
+ template: 'node-esm',
40
+ lang: 'ts'
41
+ },
42
+ {
43
+ template: 'node-esm',
44
+ lang: 'js',
45
+ tools: {
46
+ vitest: 'vitest-node-js'
47
+ }
48
+ },
49
+ {
50
+ template: 'node-esm',
51
+ lang: 'ts',
52
+ tools: {
53
+ vitest: 'vitest-node-ts'
54
+ }
55
+ },
56
+ // react-js
57
+ {
58
+ template: 'react',
59
+ lang: 'js'
60
+ },
61
+ {
62
+ template: 'react',
63
+ lang: 'js',
64
+ tools: {
65
+ storybook: 'storybook-react-js'
66
+ }
67
+ },
68
+ {
69
+ template: 'react',
70
+ lang: 'js',
71
+ tools: {
72
+ vitest: 'vitest-react-js'
73
+ }
74
+ },
75
+ {
76
+ template: 'react',
77
+ lang: 'js',
78
+ tools: {
79
+ storybook: 'storybook-react-js',
80
+ vitest: 'vitest-react-js'
81
+ }
82
+ },
83
+ // react-ts
84
+ {
85
+ template: 'react',
86
+ lang: 'ts'
87
+ },
88
+ {
89
+ template: 'react',
90
+ lang: 'ts',
91
+ tools: {
92
+ storybook: 'storybook-react-ts'
93
+ }
94
+ },
95
+ {
96
+ template: 'react',
97
+ lang: 'ts',
98
+ tools: {
99
+ vitest: 'vitest-react-ts'
100
+ }
101
+ },
102
+ {
103
+ template: 'react',
104
+ lang: 'ts',
105
+ tools: {
106
+ storybook: 'storybook-react-ts',
107
+ vitest: 'vitest-react-ts'
108
+ }
109
+ }
110
+ ];
4
111
  const src_dirname = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url));
5
112
  async function getTemplateName({ template }) {
6
113
  if ('string' == typeof template) {
@@ -13,7 +120,7 @@ async function getTemplateName({ template }) {
13
120
  // default to ts
14
121
  return `${template}-ts`;
15
122
  }
16
- const type = (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.checkCancel)(await (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.select)({
123
+ const templateName = (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.checkCancel)(await (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.select)({
17
124
  message: 'Select template',
18
125
  options: [
19
126
  {
@@ -23,6 +130,10 @@ async function getTemplateName({ template }) {
23
130
  {
24
131
  value: 'node-esm',
25
132
  label: 'Node.js pure ESM package'
133
+ },
134
+ {
135
+ value: 'react',
136
+ label: 'React'
26
137
  }
27
138
  ]
28
139
  }));
@@ -39,7 +150,29 @@ async function getTemplateName({ template }) {
39
150
  }
40
151
  ]
41
152
  }));
42
- return `${type}-${language}`;
153
+ const supportStorybook = 'react' === templateName;
154
+ const tools = (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.checkCancel)(await (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.multiselect)({
155
+ message: 'Select development tools (Use <space> to select, <enter> to continue)',
156
+ required: false,
157
+ options: [
158
+ supportStorybook && {
159
+ value: 'storybook',
160
+ label: 'Storybook'
161
+ },
162
+ {
163
+ value: 'vitest',
164
+ label: 'Vitest'
165
+ }
166
+ ].filter(Boolean)
167
+ }));
168
+ return composeTemplateName({
169
+ template: templateName,
170
+ lang: language,
171
+ tools: Object.fromEntries(tools.map((tool)=>[
172
+ tool,
173
+ `vitest-${tool}-${language}`
174
+ ]))
175
+ });
43
176
  }
44
177
  function mapESLintTemplate(templateName) {
45
178
  const language = templateName.split('-').pop();
@@ -48,12 +181,11 @@ function mapESLintTemplate(templateName) {
48
181
  (0, __WEBPACK_EXTERNAL_MODULE_create_rstack__.create)({
49
182
  root: __WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(src_dirname, '..'),
50
183
  name: 'rslib',
51
- templates: [
52
- 'node-dual-js',
53
- 'node-dual-ts',
54
- 'node-esm-js',
55
- 'node-esm-ts'
56
- ],
184
+ templates: TEMPLATES.map(({ template, tools, lang })=>composeTemplateName({
185
+ template,
186
+ lang,
187
+ tools
188
+ })),
57
189
  getTemplateName,
58
190
  mapESLintTemplate
59
191
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rslib",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Create a new Rslib project",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "repository": {
@@ -23,15 +23,16 @@
23
23
  "bin.js"
24
24
  ],
25
25
  "dependencies": {
26
- "create-rstack": "1.0.8"
26
+ "create-rstack": "1.0.9"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/fs-extra": "^11.0.4",
30
- "@types/node": "~18.19.39",
30
+ "@types/node": "^22.8.1",
31
31
  "fs-extra": "^11.2.0",
32
- "rslib": "npm:@rslib/core@0.0.14",
32
+ "rslib": "npm:@rslib/core@0.0.16",
33
+ "tsx": "^4.19.2",
33
34
  "typescript": "^5.6.3",
34
- "@rslib/core": "0.0.15",
35
+ "@rslib/core": "0.0.17",
35
36
  "@rslib/tsconfig": "0.0.1"
36
37
  },
37
38
  "engines": {
@@ -43,8 +44,10 @@
43
44
  "registry": "https://registry.npmjs.org/"
44
45
  },
45
46
  "scripts": {
46
- "build": "rslib build",
47
+ "build": "rslib build && pnpm generate-templates",
47
48
  "dev": "rslib build --watch",
48
- "start": "node ./dist/index.js"
49
+ "generate-templates": "pnpm tsx ./src/genTemplates.ts",
50
+ "start": "node ./dist/index.js",
51
+ "test": "vitest run"
49
52
  }
50
53
  }
@@ -11,5 +11,4 @@ export default defineConfig({
11
11
  syntax: 'es2021',
12
12
  },
13
13
  ],
14
- output: { target: 'node' },
15
14
  });
@@ -0,0 +1 @@
1
+ export const squared = (n) => n * n;
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@rslib/core": "workspace:*",
24
+ "@types/node": "^22.8.1",
24
25
  "typescript": "^5.6.3"
25
26
  }
26
27
  }
@@ -12,5 +12,4 @@ export default defineConfig({
12
12
  syntax: 'es2021',
13
13
  },
14
14
  ],
15
- output: { target: 'node' },
16
15
  });
@@ -0,0 +1 @@
1
+ export const squared = (n: number): number => n * n;
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2020",
4
- "lib": ["DOM", "ES2020"],
3
+ "lib": ["ES2021"],
5
4
  "module": "ESNext",
6
5
  "noEmit": true,
7
6
  "strict": true,
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "rslib-node-dual-js",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./dist/index.js",
8
+ "require": "./dist/index.cjs"
9
+ }
10
+ },
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "dev": "rslib build --watch",
19
+ "test": "vitest run"
20
+ },
21
+ "devDependencies": {
22
+ "@rslib/core": "workspace:*",
23
+ "vitest": "^2.1.4"
24
+ }
25
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [
5
+ {
6
+ format: 'esm',
7
+ syntax: 'es2021',
8
+ },
9
+ {
10
+ format: 'cjs',
11
+ syntax: 'es2021',
12
+ },
13
+ ],
14
+ });
@@ -0,0 +1 @@
1
+ export const squared = (n) => n * n;
@@ -0,0 +1,7 @@
1
+ import { expect, test } from 'vitest';
2
+ import { squared } from '../src/index';
3
+
4
+ test('squared', () => {
5
+ expect(squared(2)).toBe(4);
6
+ expect(squared(12)).toBe(144);
7
+ });
@@ -0,0 +1,8 @@
1
+ /// <reference types="vitest/config" />
2
+
3
+ import { defineConfig } from 'vitest/config';
4
+
5
+ export default defineConfig({
6
+ // Configure Vitest (https://vitest.dev/config/)
7
+ test: {},
8
+ });
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "rslib-node-dual-ts",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js",
9
+ "require": "./dist/index.cjs"
10
+ }
11
+ },
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "rslib build",
20
+ "dev": "rslib build --watch",
21
+ "test": "vitest run"
22
+ },
23
+ "devDependencies": {
24
+ "@rslib/core": "workspace:*",
25
+ "@types/node": "^22.8.1",
26
+ "typescript": "^5.6.3",
27
+ "vitest": "^2.1.4"
28
+ }
29
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [
5
+ {
6
+ format: 'esm',
7
+ syntax: 'es2021',
8
+ dts: true,
9
+ },
10
+ {
11
+ format: 'cjs',
12
+ syntax: 'es2021',
13
+ },
14
+ ],
15
+ });
@@ -0,0 +1 @@
1
+ export const squared = (n: number): number => n * n;
@@ -0,0 +1,7 @@
1
+ import { expect, test } from 'vitest';
2
+ import { squared } from '../src/index';
3
+
4
+ test('squared', () => {
5
+ expect(squared(2)).toBe(4);
6
+ expect(squared(12)).toBe(144);
7
+ });
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2021",
4
- "lib": ["DOM", "ES2021"],
3
+ "lib": ["ES2021"],
5
4
  "module": "ESNext",
6
5
  "noEmit": true,
7
6
  "strict": true,
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ // Configure Vitest (https://vitest.dev/config/)
5
+ test: {},
6
+ });
@@ -7,5 +7,4 @@ export default defineConfig({
7
7
  syntax: 'es2021',
8
8
  },
9
9
  ],
10
- output: { target: 'node' },
11
10
  });
@@ -0,0 +1 @@
1
+ export const squared = (n) => n * n;
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rslib/core": "workspace:*",
22
+ "@types/node": "^22.8.1",
22
23
  "typescript": "^5.6.3"
23
24
  }
24
25
  }
@@ -8,5 +8,4 @@ export default defineConfig({
8
8
  dts: true,
9
9
  },
10
10
  ],
11
- output: { target: 'node' },
12
11
  });
@@ -0,0 +1 @@
1
+ export const squared = (n: number): number => n * n;
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ES2021"],
4
+ "module": "ESNext",
5
+ "noEmit": true,
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler",
11
+ "useDefineForClassFields": true,
12
+ "allowImportingTsExtensions": true
13
+ },
14
+ "include": ["src"]
15
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "rslib-node-esm-js",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./dist/index.js"
8
+ }
9
+ },
10
+ "module": "./dist/index.js",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "rslib build",
16
+ "dev": "rslib build --watch",
17
+ "test": "vitest run"
18
+ },
19
+ "devDependencies": {
20
+ "@rslib/core": "workspace:*",
21
+ "vitest": "^2.1.4"
22
+ }
23
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [
5
+ {
6
+ format: 'esm',
7
+ syntax: 'es2021',
8
+ },
9
+ ],
10
+ });
@@ -0,0 +1 @@
1
+ export const squared = (n) => n * n;
@@ -0,0 +1,7 @@
1
+ import { expect, test } from 'vitest';
2
+ import { squared } from '../src/index';
3
+
4
+ test('squared', () => {
5
+ expect(squared(2)).toBe(4);
6
+ expect(squared(12)).toBe(144);
7
+ });
@@ -0,0 +1,8 @@
1
+ /// <reference types="vitest/config" />
2
+
3
+ import { defineConfig } from 'vitest/config';
4
+
5
+ export default defineConfig({
6
+ // Configure Vitest (https://vitest.dev/config/)
7
+ test: {},
8
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "rslib-node-esm-ts",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "dev": "rslib build --watch",
19
+ "test": "vitest run"
20
+ },
21
+ "devDependencies": {
22
+ "@rslib/core": "workspace:*",
23
+ "@types/node": "^22.8.1",
24
+ "typescript": "^5.6.3",
25
+ "vitest": "^2.1.4"
26
+ }
27
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [
5
+ {
6
+ format: 'esm',
7
+ syntax: 'es2021',
8
+ dts: true,
9
+ },
10
+ ],
11
+ });
@@ -0,0 +1 @@
1
+ export const squared = (n: number): number => n * n;
@@ -0,0 +1,7 @@
1
+ import { expect, test } from 'vitest';
2
+ import { squared } from '../src/index';
3
+
4
+ test('squared', () => {
5
+ expect(squared(2)).toBe(4);
6
+ expect(squared(12)).toBe(144);
7
+ });
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ES2021"],
4
+ "module": "ESNext",
5
+ "noEmit": true,
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "isolatedModules": true,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "bundler",
11
+ "useDefineForClassFields": true,
12
+ "allowImportingTsExtensions": true
13
+ },
14
+ "include": ["src"]
15
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ // Configure Vitest (https://vitest.dev/config/)
5
+ test: {},
6
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "rslib-react-js",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./dist/index.js"
8
+ }
9
+ },
10
+ "module": "./dist/index.js",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "rslib build",
16
+ "dev": "rslib build --watch"
17
+ },
18
+ "devDependencies": {
19
+ "@rsbuild/plugin-react": "^1.0.7",
20
+ "@rslib/core": "workspace:*",
21
+ "react": "^18.3.1"
22
+ },
23
+ "peerDependencies": {
24
+ "react": ">=16.9.0",
25
+ "react-dom": ">=16.9.0"
26
+ }
27
+ }
@@ -0,0 +1,26 @@
1
+ import { pluginReact } from '@rsbuild/plugin-react';
2
+ import { defineConfig } from '@rslib/core';
3
+
4
+ export default defineConfig({
5
+ source: {
6
+ entry: {
7
+ index: ['./src/**'],
8
+ },
9
+ },
10
+ lib: [
11
+ {
12
+ bundle: false,
13
+ format: 'esm',
14
+ },
15
+ ],
16
+ output: {
17
+ target: 'web',
18
+ },
19
+ plugins: [
20
+ pluginReact({
21
+ swcReactOptions: {
22
+ runtime: 'classic',
23
+ },
24
+ }),
25
+ ],
26
+ });