@rsbuild/core 0.0.0-next-20231103091827

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 (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/bin/rsbuild.js +24 -0
  4. package/dist/cli/commands.d.ts +7 -0
  5. package/dist/cli/commands.js +53 -0
  6. package/dist/cli/config.d.ts +12 -0
  7. package/dist/cli/config.js +90 -0
  8. package/dist/cli/index.d.ts +6 -0
  9. package/dist/cli/index.js +48 -0
  10. package/dist/createRsbuild.d.ts +11 -0
  11. package/dist/createRsbuild.js +103 -0
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +36 -0
  14. package/dist/plugins/asset.d.ts +3 -0
  15. package/dist/plugins/asset.js +67 -0
  16. package/dist/plugins/assetsRetry.d.ts +2 -0
  17. package/dist/plugins/assetsRetry.js +66 -0
  18. package/dist/plugins/bundleAnalyzer.d.ts +2 -0
  19. package/dist/plugins/bundleAnalyzer.js +59 -0
  20. package/dist/plugins/cache.d.ts +2 -0
  21. package/dist/plugins/cache.js +115 -0
  22. package/dist/plugins/cleanOutput.d.ts +2 -0
  23. package/dist/plugins/cleanOutput.js +47 -0
  24. package/dist/plugins/define.d.ts +2 -0
  25. package/dist/plugins/define.js +59 -0
  26. package/dist/plugins/devtool.d.ts +2 -0
  27. package/dist/plugins/devtool.js +46 -0
  28. package/dist/plugins/entry.d.ts +2 -0
  29. package/dist/plugins/entry.js +42 -0
  30. package/dist/plugins/externals.d.ts +2 -0
  31. package/dist/plugins/externals.js +48 -0
  32. package/dist/plugins/fileSize.d.ts +4 -0
  33. package/dist/plugins/fileSize.js +160 -0
  34. package/dist/plugins/html.d.ts +7 -0
  35. package/dist/plugins/html.js +242 -0
  36. package/dist/plugins/index.d.ts +2 -0
  37. package/dist/plugins/index.js +67 -0
  38. package/dist/plugins/inlineChunk.d.ts +2 -0
  39. package/dist/plugins/inlineChunk.js +85 -0
  40. package/dist/plugins/moment.d.ts +2 -0
  41. package/dist/plugins/moment.js +43 -0
  42. package/dist/plugins/networkPerformance.d.ts +2 -0
  43. package/dist/plugins/networkPerformance.js +58 -0
  44. package/dist/plugins/nodeAddons.d.ts +2 -0
  45. package/dist/plugins/nodeAddons.js +78 -0
  46. package/dist/plugins/performance.d.ts +5 -0
  47. package/dist/plugins/performance.js +63 -0
  48. package/dist/plugins/preloadOrPrefetch.d.ts +2 -0
  49. package/dist/plugins/preloadOrPrefetch.js +61 -0
  50. package/dist/plugins/rem.d.ts +2 -0
  51. package/dist/plugins/rem.js +103 -0
  52. package/dist/plugins/splitChunks.d.ts +4 -0
  53. package/dist/plugins/splitChunks.js +251 -0
  54. package/dist/plugins/startUrl.d.ts +12 -0
  55. package/dist/plugins/startUrl.js +146 -0
  56. package/dist/plugins/target.d.ts +2 -0
  57. package/dist/plugins/target.js +53 -0
  58. package/dist/plugins/toml.d.ts +2 -0
  59. package/dist/plugins/toml.js +36 -0
  60. package/dist/plugins/wasm.d.ts +2 -0
  61. package/dist/plugins/wasm.js +51 -0
  62. package/dist/plugins/yaml.d.ts +2 -0
  63. package/dist/plugins/yaml.js +36 -0
  64. package/dist/rspack-provider/config/defaults.d.ts +3 -0
  65. package/dist/rspack-provider/config/defaults.js +40 -0
  66. package/dist/rspack-provider/config/normalize.d.ts +7 -0
  67. package/dist/rspack-provider/config/normalize.js +33 -0
  68. package/dist/rspack-provider/core/build.d.ts +19 -0
  69. package/dist/rspack-provider/core/build.js +79 -0
  70. package/dist/rspack-provider/core/createCompiler.d.ts +9 -0
  71. package/dist/rspack-provider/core/createCompiler.js +83 -0
  72. package/dist/rspack-provider/core/createContext.d.ts +7 -0
  73. package/dist/rspack-provider/core/createContext.js +47 -0
  74. package/dist/rspack-provider/core/devMiddleware.d.ts +5 -0
  75. package/dist/rspack-provider/core/devMiddleware.js +65 -0
  76. package/dist/rspack-provider/core/initConfigs.d.ts +14 -0
  77. package/dist/rspack-provider/core/initConfigs.js +76 -0
  78. package/dist/rspack-provider/core/initHooks.d.ts +18 -0
  79. package/dist/rspack-provider/core/initHooks.js +45 -0
  80. package/dist/rspack-provider/core/initPlugins.d.ts +9 -0
  81. package/dist/rspack-provider/core/initPlugins.js +82 -0
  82. package/dist/rspack-provider/core/inspectConfig.d.ts +19 -0
  83. package/dist/rspack-provider/core/inspectConfig.js +81 -0
  84. package/dist/rspack-provider/core/rspackConfig.d.ts +9 -0
  85. package/dist/rspack-provider/core/rspackConfig.js +137 -0
  86. package/dist/rspack-provider/core/startDevServer.d.ts +6 -0
  87. package/dist/rspack-provider/core/startDevServer.js +84 -0
  88. package/dist/rspack-provider/index.d.ts +5 -0
  89. package/dist/rspack-provider/index.js +31 -0
  90. package/dist/rspack-provider/plugins/basic.d.ts +5 -0
  91. package/dist/rspack-provider/plugins/basic.js +34 -0
  92. package/dist/rspack-provider/plugins/css.d.ts +29 -0
  93. package/dist/rspack-provider/plugins/css.js +214 -0
  94. package/dist/rspack-provider/plugins/fallback.d.ts +2 -0
  95. package/dist/rspack-provider/plugins/fallback.js +54 -0
  96. package/dist/rspack-provider/plugins/hmr.d.ts +2 -0
  97. package/dist/rspack-provider/plugins/hmr.js +38 -0
  98. package/dist/rspack-provider/plugins/less.d.ts +2 -0
  99. package/dist/rspack-provider/plugins/less.js +78 -0
  100. package/dist/rspack-provider/plugins/manifest.d.ts +2 -0
  101. package/dist/rspack-provider/plugins/manifest.js +58 -0
  102. package/dist/rspack-provider/plugins/minimize.d.ts +5 -0
  103. package/dist/rspack-provider/plugins/minimize.js +77 -0
  104. package/dist/rspack-provider/plugins/output.d.ts +2 -0
  105. package/dist/rspack-provider/plugins/output.js +65 -0
  106. package/dist/rspack-provider/plugins/progress.d.ts +2 -0
  107. package/dist/rspack-provider/plugins/progress.js +57 -0
  108. package/dist/rspack-provider/plugins/resolve.d.ts +2 -0
  109. package/dist/rspack-provider/plugins/resolve.js +55 -0
  110. package/dist/rspack-provider/plugins/rspack-profile.d.ts +4 -0
  111. package/dist/rspack-provider/plugins/rspack-profile.js +107 -0
  112. package/dist/rspack-provider/plugins/sass.d.ts +2 -0
  113. package/dist/rspack-provider/plugins/sass.js +83 -0
  114. package/dist/rspack-provider/plugins/swc.d.ts +7 -0
  115. package/dist/rspack-provider/plugins/swc.js +151 -0
  116. package/dist/rspack-provider/plugins/transition.d.ts +5 -0
  117. package/dist/rspack-provider/plugins/transition.js +42 -0
  118. package/dist/rspack-provider/provider.d.ts +8 -0
  119. package/dist/rspack-provider/provider.js +116 -0
  120. package/dist/rspack-provider/rspackLoader/css-modules-typescript-pre-loader/index.d.ts +6 -0
  121. package/dist/rspack-provider/rspackLoader/css-modules-typescript-pre-loader/index.js +84 -0
  122. package/dist/rspack-provider/rspackLoader/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.d.ts +11 -0
  123. package/dist/rspack-provider/rspackLoader/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.js +67 -0
  124. package/dist/rspack-provider/rspackPlugin/removeCssSourcemapPlugin.d.ts +8 -0
  125. package/dist/rspack-provider/rspackPlugin/removeCssSourcemapPlugin.js +51 -0
  126. package/dist/rspack-provider/shared/constants.d.ts +1 -0
  127. package/dist/rspack-provider/shared/constants.js +28 -0
  128. package/dist/rspack-provider/shared/fs.d.ts +1 -0
  129. package/dist/rspack-provider/shared/fs.js +38 -0
  130. package/dist/rspack-provider/shared/index.d.ts +3 -0
  131. package/dist/rspack-provider/shared/index.js +26 -0
  132. package/dist/rspack-provider/shared/plugin.d.ts +3 -0
  133. package/dist/rspack-provider/shared/plugin.js +83 -0
  134. package/dist/rspack-provider/shared/rspackVersion.d.ts +3 -0
  135. package/dist/rspack-provider/shared/rspackVersion.js +61 -0
  136. package/dist/rspack-provider/types/context.d.ts +16 -0
  137. package/dist/rspack-provider/types/context.js +16 -0
  138. package/dist/rspack-provider/types/hooks.d.ts +3 -0
  139. package/dist/rspack-provider/types/hooks.js +16 -0
  140. package/dist/rspack-provider/types/index.d.ts +4 -0
  141. package/dist/rspack-provider/types/index.js +26 -0
  142. package/dist/rspack-provider/types/plugin.d.ts +7 -0
  143. package/dist/rspack-provider/types/plugin.js +16 -0
  144. package/dist/utils/generateMetaTags.d.ts +12 -0
  145. package/dist/utils/generateMetaTags.js +50 -0
  146. package/package.json +98 -0
  147. package/static/openChrome.applescript +95 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var generateMetaTags_exports = {};
20
+ __export(generateMetaTags_exports, {
21
+ generateMetaTags: () => generateMetaTags
22
+ });
23
+ module.exports = __toCommonJS(generateMetaTags_exports);
24
+ const generateMetaTags = (metaOptions) => {
25
+ if (!metaOptions) {
26
+ return [];
27
+ }
28
+ const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
29
+ const metaTagContent = metaOptions[metaName];
30
+ return typeof metaTagContent === "string" ? {
31
+ name: metaName,
32
+ content: metaTagContent
33
+ } : metaTagContent;
34
+ }).filter((attribute) => attribute !== false);
35
+ return metaTagAttributeObjects.map((metaTagAttributes) => {
36
+ if (metaTagAttributes === false) {
37
+ throw new Error("Invalid meta tag");
38
+ }
39
+ return {
40
+ tagName: "meta",
41
+ voidTag: true,
42
+ attributes: metaTagAttributes,
43
+ meta: {}
44
+ };
45
+ });
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ generateMetaTags
50
+ });
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@rsbuild/core",
3
+ "version": "0.0.0-next-20231103091827",
4
+ "description": "Unleash the power of Rspack with the out-of-the-box build tool.",
5
+ "homepage": "https://rsbuild.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/web-infra-dev/rsbuild/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/web-infra-dev/rsbuild",
12
+ "directory": "packages/core"
13
+ },
14
+ "license": "MIT",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./cli": {
21
+ "types": "./dist/cli/index.d.ts",
22
+ "default": "./dist/cli/index.js"
23
+ },
24
+ "./plugins/*": {
25
+ "types": "./dist/plugins/*.d.ts",
26
+ "default": "./dist/plugins/*.js"
27
+ },
28
+ "./rspack-plugin-css": {
29
+ "types": "./dist/rspack-provider/plugins/css.d.ts",
30
+ "default": "./dist/rspack-provider/plugins/css.js"
31
+ },
32
+ "./rspack-provider": {
33
+ "types": "./dist/rspack-provider/index.d.ts",
34
+ "default": "./dist/rspack-provider/index.js"
35
+ }
36
+ },
37
+ "main": "./dist/index.js",
38
+ "types": "./dist/index.d.ts",
39
+ "typesVersions": {
40
+ "*": {
41
+ "cli": [
42
+ "./dist/cli/index.d.ts"
43
+ ],
44
+ "plugins/*": [
45
+ "./dist/plugins/*.d.ts"
46
+ ],
47
+ "rspack-plugin-css": [
48
+ "./dist/rspack-provider/plugins/css.d.ts"
49
+ ],
50
+ "rspack-provider": [
51
+ "./dist/rspack-provider/index.d.ts"
52
+ ]
53
+ }
54
+ },
55
+ "bin": {
56
+ "rsbuild": "./bin/rsbuild.js"
57
+ },
58
+ "files": [
59
+ "bin",
60
+ "dist",
61
+ "static"
62
+ ],
63
+ "dependencies": {
64
+ "@modern-js/server": "^2.39.2",
65
+ "@rspack/core": "0.3.10",
66
+ "commander": "^10.0.1",
67
+ "filesize": "^8.0.7",
68
+ "gzip-size": "^6.0.0",
69
+ "html-webpack-plugin": "5.5.3",
70
+ "jiti": "^1.20.0",
71
+ "lodash": "^4.17.21",
72
+ "open": "^8.4.0",
73
+ "pkg-up": "^3.1.0",
74
+ "postcss": "8.4.31",
75
+ "rspack-manifest-plugin": "5.0.0-alpha0",
76
+ "semver": "^7.5.4",
77
+ "webpack": "^5.89.0",
78
+ "@rsbuild/shared": "0.0.0-next-20231103091827"
79
+ },
80
+ "devDependencies": {
81
+ "@types/lodash": "^4.14.200",
82
+ "@types/node": "^16",
83
+ "@types/semver": "^7.5.4",
84
+ "typescript": "^5.2.2"
85
+ },
86
+ "engines": {
87
+ "node": ">=14.0.0"
88
+ },
89
+ "publishConfig": {
90
+ "access": "public",
91
+ "provenance": true,
92
+ "registry": "https://registry.npmjs.org/"
93
+ },
94
+ "scripts": {
95
+ "build": "modern build",
96
+ "dev": "modern build --watch"
97
+ }
98
+ }
@@ -0,0 +1,95 @@
1
+ (*
2
+ Copyright (c) 2015-present, Facebook, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file at
6
+ https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
7
+ *)
8
+
9
+ property targetTab: null
10
+ property targetTabIndex: -1
11
+ property targetWindow: null
12
+ property theProgram: "Google Chrome"
13
+
14
+ on run argv
15
+ set theURL to item 1 of argv
16
+
17
+ -- Allow requested program to be optional,
18
+ -- default to Google Chrome
19
+ if (count of argv) > 1 then
20
+ set theProgram to item 2 of argv
21
+ end if
22
+
23
+ using terms from application "Google Chrome"
24
+ tell application theProgram
25
+
26
+ if (count every window) = 0 then
27
+ make new window
28
+ end if
29
+
30
+ -- 1: Looking for tab running debugger
31
+ -- then, Reload debugging tab if found
32
+ -- then return
33
+ set found to my lookupTabWithUrl(theURL)
34
+ if found then
35
+ set targetWindow's active tab index to targetTabIndex
36
+ tell targetTab to reload
37
+ tell targetWindow to activate
38
+ set index of targetWindow to 1
39
+ return
40
+ end if
41
+
42
+ -- 2: Looking for Empty tab
43
+ -- In case debugging tab was not found
44
+ -- We try to find an empty tab instead
45
+ set found to my lookupTabWithUrl("chrome://newtab/")
46
+ if found then
47
+ set targetWindow's active tab index to targetTabIndex
48
+ set URL of targetTab to theURL
49
+ tell targetWindow to activate
50
+ return
51
+ end if
52
+
53
+ -- 3: Create new tab
54
+ -- both debugging and empty tab were not found
55
+ -- make a new tab with url
56
+ tell window 1
57
+ activate
58
+ make new tab with properties {URL:theURL}
59
+ end tell
60
+ end tell
61
+ end using terms from
62
+ end run
63
+
64
+ -- Function:
65
+ -- Lookup tab with given url
66
+ -- if found, store tab, index, and window in properties
67
+ -- (properties were declared on top of file)
68
+ on lookupTabWithUrl(lookupUrl)
69
+ using terms from application "Google Chrome"
70
+ tell application theProgram
71
+ -- Find a tab with the given url
72
+ set found to false
73
+ set theTabIndex to -1
74
+ repeat with theWindow in every window
75
+ set theTabIndex to 0
76
+ repeat with theTab in every tab of theWindow
77
+ set theTabIndex to theTabIndex + 1
78
+ if (theTab's URL as string) contains lookupUrl then
79
+ -- assign tab, tab index, and window to properties
80
+ set targetTab to theTab
81
+ set targetTabIndex to theTabIndex
82
+ set targetWindow to theWindow
83
+ set found to true
84
+ exit repeat
85
+ end if
86
+ end repeat
87
+
88
+ if found then
89
+ exit repeat
90
+ end if
91
+ end repeat
92
+ end tell
93
+ end using terms from
94
+ return found
95
+ end lookupTabWithUrl