@mainset/builder-rslib 0.1.0 → 0.2.0

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,2 +1,3 @@
1
- export { generateNodePackageRslibConfig } from './rslib.node-package.config.mjs';
1
+ export { generateNodeSourcerRslibConfig } from './rslib.node-sourcer.config.mjs';
2
2
  export { generateReactRslibConfig } from './rslib.react.config.mjs';
3
+ export { generateWebPackageRslibConfig } from './rslib.web-package.config.mjs';
@@ -6,7 +6,7 @@ import { initRslibConfigGenerator } from './utils.mjs';
6
6
  // NOTE: there is no sense in minimizing {*.min.js} / {*.min.css} output files in node package
7
7
  // during development debugging complete JS code / full CSS class gives a better dev experience
8
8
  // the bundler of the final web app should be responsible for the minification of the final output files
9
- const nodePackageCommonPresetRslib = defineConfig({
9
+ const nodeSourcerCommonPresetRslib = defineConfig({
10
10
  mode: process.env.NODE_ENV || NODE_ENV.PRODUCTION,
11
11
  lib: [
12
12
  {
@@ -17,6 +17,13 @@ const nodePackageCommonPresetRslib = defineConfig({
17
17
  js: 'esm/index.mjs',
18
18
  },
19
19
  },
20
+ autoExternal: {
21
+ // NOTE: bundle source of node_modules from dependencies into the lib build
22
+ dependencies: false,
23
+ devDependencies: true,
24
+ peerDependencies: true,
25
+ optionalDependencies: true,
26
+ },
20
27
  },
21
28
  {
22
29
  format: 'cjs',
@@ -26,6 +33,13 @@ const nodePackageCommonPresetRslib = defineConfig({
26
33
  js: 'cjs/index.cjs',
27
34
  },
28
35
  },
36
+ autoExternal: {
37
+ // NOTE: bundle source of of node_modules from dependencies into the lib build
38
+ dependencies: false,
39
+ devDependencies: true,
40
+ peerDependencies: true,
41
+ optionalDependencies: true,
42
+ },
29
43
  },
30
44
  ],
31
45
  source: {
@@ -34,29 +48,13 @@ const nodePackageCommonPresetRslib = defineConfig({
34
48
  },
35
49
  },
36
50
  output: {
37
- target: 'web',
51
+ target: 'node',
38
52
  distPath: {
39
53
  root: runtimePathById.dist,
40
54
  },
41
- filename: {
42
- css: `css/main.css`,
43
- },
44
- // CssModules: {
45
- // localIdentName: '[local]--[hash:base64:6]',
46
- // },
47
- // https://rsbuild.dev/config/output/source-map#default-behavior
48
- // sourceMap: true,
49
- },
50
- tools: {
51
- cssLoader: {
52
- modules: {
53
- // Support CSS Modules syntax as {import styles from './styles.module.css'}
54
- namedExport: true,
55
- },
56
- },
57
55
  },
58
56
  });
59
- const generateNodePackageRslibConfig = initRslibConfigGenerator(nodePackageCommonPresetRslib);
60
- export { generateNodePackageRslibConfig, nodePackageCommonPresetRslib };
57
+ const generateNodeSourcerRslibConfig = initRslibConfigGenerator(nodeSourcerCommonPresetRslib);
58
+ export { generateNodeSourcerRslibConfig, nodeSourcerCommonPresetRslib };
61
59
  // NOTE: the default export is used to point config file in {mainset-cli}
62
- export default nodePackageCommonPresetRslib;
60
+ export default nodeSourcerCommonPresetRslib;
@@ -2,9 +2,9 @@ import '@mainset/cli/process-env-type';
2
2
  import { merge } from '@mainset/toolkit-js';
3
3
  import { pluginReact } from '@rsbuild/plugin-react';
4
4
  import { pluginSass } from '@rsbuild/plugin-sass';
5
- import { nodePackageCommonPresetRslib } from './rslib.node-package.config.mjs';
5
+ import { webPackageCommonPresetRslib } from './rslib.web-package.config.mjs';
6
6
  import { initRslibConfigGenerator } from './utils.mjs';
7
- const reactCommonPresetRslib = merge(nodePackageCommonPresetRslib, {
7
+ const reactCommonPresetRslib = merge(webPackageCommonPresetRslib, {
8
8
  lib: [],
9
9
  plugins: [pluginReact(), pluginSass()],
10
10
  });
@@ -32,7 +32,7 @@ const ssrServerPresetRslib = defineConfig({
32
32
  source: {
33
33
  entry: {
34
34
  'ssr-server.config': [
35
- path.join(runtimePathById.root, 'config', 'ssr-server.config.mts'),
35
+ path.join(runtimePathById.config, 'ssr-server.config.mts'),
36
36
  ],
37
37
  },
38
38
  },
@@ -0,0 +1,33 @@
1
+ import '@mainset/cli/process-env-type';
2
+ import { merge } from '@mainset/toolkit-js';
3
+ import { nodeSourcerCommonPresetRslib } from './rslib.node-sourcer.config.mjs';
4
+ import { initRslibConfigGenerator } from './utils.mjs';
5
+ // NOTE: there is no sense in minimizing {*.min.js} / {*.min.css} output files in node package
6
+ // during development debugging complete JS code / full CSS class gives a better dev experience
7
+ // the bundler of the final web app should be responsible for the minification of the final output files
8
+ const webPackageCommonPresetRslib = merge(nodeSourcerCommonPresetRslib, {
9
+ lib: [],
10
+ output: {
11
+ target: 'web',
12
+ filename: {
13
+ css: 'css/main.css',
14
+ },
15
+ // CssModules: {
16
+ // localIdentName: '[local]--[hash:base64:6]',
17
+ // },
18
+ // https://rsbuild.dev/config/output/source-map#default-behavior
19
+ // sourceMap: true,
20
+ },
21
+ tools: {
22
+ cssLoader: {
23
+ modules: {
24
+ // Support CSS Modules syntax as {import styles from './styles.module.css'}
25
+ namedExport: true,
26
+ },
27
+ },
28
+ },
29
+ });
30
+ const generateWebPackageRslibConfig = initRslibConfigGenerator(webPackageCommonPresetRslib);
31
+ export { generateWebPackageRslibConfig, webPackageCommonPresetRslib };
32
+ // NOTE: the default export is used to point config file in {mainset-cli}
33
+ export default webPackageCommonPresetRslib;
@@ -1,2 +1,4 @@
1
- export { generateNodePackageRslibConfig } from './rslib.node-package.config.mjs';
1
+ export type { RslibConfig } from '@rslib/core';
2
+ export { generateNodeSourcerRslibConfig } from './rslib.node-sourcer.config.mjs';
2
3
  export { generateReactRslibConfig } from './rslib.react.config.mjs';
4
+ export { generateWebPackageRslibConfig } from './rslib.web-package.config.mjs';
@@ -0,0 +1,5 @@
1
+ import '@mainset/cli/process-env-type';
2
+ declare const nodeSourcerCommonPresetRslib: import("@rslib/core").RslibConfig;
3
+ declare const generateNodeSourcerRslibConfig: (extendedConfig?: Omit<import("@rslib/core").RslibConfig, "lib">) => Omit<import("@rslib/core").RslibConfig, "lib">;
4
+ export { generateNodeSourcerRslibConfig, nodeSourcerCommonPresetRslib };
5
+ export default nodeSourcerCommonPresetRslib;
@@ -0,0 +1,5 @@
1
+ import '@mainset/cli/process-env-type';
2
+ declare const webPackageCommonPresetRslib: import("@rslib/core").RslibConfig;
3
+ declare const generateWebPackageRslibConfig: (extendedConfig?: Omit<import("@rslib/core").RslibConfig, "lib">) => Omit<import("@rslib/core").RslibConfig, "lib">;
4
+ export { generateWebPackageRslibConfig, webPackageCommonPresetRslib };
5
+ export default webPackageCommonPresetRslib;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mainset/builder-rslib",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Builder for node packages",
5
5
  "homepage": "https://github.com/mainset/dev-stack-fe/tree/main/packages/builder-rslib",
6
6
  "bugs": {
@@ -24,14 +24,19 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@rsbuild/plugin-react": "^1.3.2",
28
- "@rsbuild/plugin-sass": "^1.3.2",
29
- "@rslib/core": "^0.10.2"
27
+ "@rsbuild/plugin-react": "^1.4.1",
28
+ "@rsbuild/plugin-sass": "^1.4.0",
29
+ "@rslib/core": "^0.15.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@mainset/cli": "^0.1.0",
33
- "@mainset/toolkit-js": "^0.1.0",
34
- "@mainset/dev-stack-fe": "^0.1.0"
32
+ "@mainset/toolkit-js": "^0.1.1",
33
+ "@mainset/dev-stack-fe": "^0.2.0",
34
+ "@mainset/cli": "^0.4.0"
35
+ },
36
+ "peerDependencies": {
37
+ "@mainset/cli": "^0.3.0",
38
+ "@mainset/dev-stack-fe": "^0.2.0",
39
+ "@mainset/toolkit-js": "^0.1.1"
35
40
  },
36
41
  "scripts": {
37
42
  "build": "ms-cli source-code --exec compile",
@@ -1,5 +0,0 @@
1
- import '@mainset/cli/process-env-type';
2
- declare const nodePackageCommonPresetRslib: import("@rslib/core").RslibConfig;
3
- declare const generateNodePackageRslibConfig: (extendedConfig?: Omit<import("@rslib/core").RslibConfig, "lib">) => Omit<import("@rslib/core").RslibConfig, "lib">;
4
- export { generateNodePackageRslibConfig, nodePackageCommonPresetRslib };
5
- export default nodePackageCommonPresetRslib;