dextuploadx5-react-webpack 0.0.1
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/LICENSE +66 -0
- package/README.md +154 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
DEXTUploadX5 React Webpack Helper Free Use License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DEXTSolution
|
|
4
|
+
|
|
5
|
+
For the purposes of this License, "Software" means only the DEXTUploadX5 React
|
|
6
|
+
Webpack Helper package distributed with this License, and does not include the
|
|
7
|
+
DEXTUploadX5 product itself, which is licensed separately as a commercial product.
|
|
8
|
+
|
|
9
|
+
1. Grant of License
|
|
10
|
+
Subject to the terms of this License, you are granted a worldwide, non-exclusive,
|
|
11
|
+
non-transferable, revocable license to:
|
|
12
|
+
|
|
13
|
+
- use the Software for personal, internal business, and commercial purposes;
|
|
14
|
+
- install and run the Software in development, test, and production environments;
|
|
15
|
+
- modify the Software for your own internal use.
|
|
16
|
+
|
|
17
|
+
2. Restrictions
|
|
18
|
+
You may not, without prior written permission from the copyright holder:
|
|
19
|
+
|
|
20
|
+
- distribute, sublicense, sell, rent, lease, or otherwise make the Software available
|
|
21
|
+
to any third party as a standalone product;
|
|
22
|
+
- publish, redistribute, or repackage the Software through npm, GitHub Packages,
|
|
23
|
+
private registries, mirrors, CDNs, or any other package distribution channel;
|
|
24
|
+
- distribute, publish, sublicense, sell, or otherwise provide any modified version,
|
|
25
|
+
derivative work, or fork of the Software, in source or binary form;
|
|
26
|
+
- remove, alter, or obscure any copyright, trademark, or license notice contained in
|
|
27
|
+
the Software;
|
|
28
|
+
- use the name of the copyright holder, product name, or trademarks to market or
|
|
29
|
+
imply endorsement of any derivative or related product.
|
|
30
|
+
|
|
31
|
+
3. Ownership
|
|
32
|
+
The Software is licensed, not sold. All right, title, and interest in and to the
|
|
33
|
+
Software, including all intellectual property rights, remain with the copyright holder.
|
|
34
|
+
|
|
35
|
+
4. Internal Modifications
|
|
36
|
+
You may create and use modified versions of the Software internally within your
|
|
37
|
+
organization. Such modified versions may not be distributed, shared, sublicensed,
|
|
38
|
+
sold, or otherwise provided to any third party.
|
|
39
|
+
|
|
40
|
+
5. No Open Source Rights
|
|
41
|
+
This License does not grant any right to distribute modified versions or derivative
|
|
42
|
+
works, and it is not an open source license.
|
|
43
|
+
|
|
44
|
+
6. Termination
|
|
45
|
+
This License terminates automatically if you fail to comply with any term of this
|
|
46
|
+
License. Upon termination, you must cease all use of the Software and destroy all
|
|
47
|
+
copies in your possession or control, except to the extent retention is required by law.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
51
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
52
|
+
PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, ACCURACY, OR THAT THE SOFTWARE WILL BE
|
|
53
|
+
ERROR-FREE OR UNINTERRUPTED.
|
|
54
|
+
|
|
55
|
+
8. Limitation of Liability
|
|
56
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE COPYRIGHT
|
|
57
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
|
|
58
|
+
IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
|
|
59
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE, INCLUDING BUT NOT
|
|
60
|
+
LIMITED TO ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE
|
|
61
|
+
DAMAGES, LOSS OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION, OR PROCUREMENT OF
|
|
62
|
+
SUBSTITUTE GOODS OR SERVICES.
|
|
63
|
+
|
|
64
|
+
9. Governing Law
|
|
65
|
+
This License shall be governed by and construed in accordance with the laws of the
|
|
66
|
+
Republic of Korea, excluding its conflict of laws principles.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# DEXTUploadX5 React Webpack Helper
|
|
2
|
+
|
|
3
|
+
Webpack helper package for `dextuploadx5-react`.
|
|
4
|
+
|
|
5
|
+
`dextuploadx5-react` requires the DX5 static files to be available at the
|
|
6
|
+
runtime `productPath`.
|
|
7
|
+
|
|
8
|
+
This package automates that setup in Webpack projects. During development or
|
|
9
|
+
production builds, it copies the DX5 files to the path that will be served as
|
|
10
|
+
`productPath` and can also register that directory in `devServer`.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Exposes `withDEXTUploadX5()` to extend an existing Webpack config
|
|
15
|
+
- Automatically copies DX5 static files to the location served as `productPath`
|
|
16
|
+
- Works in both development and production Webpack workflows
|
|
17
|
+
- Can copy DX5 static files into the Webpack output directory
|
|
18
|
+
- Can copy DX5 static files into a separate public directory
|
|
19
|
+
- Can register static directories in `webpack-dev-server`
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
- Webpack 5 or later
|
|
24
|
+
- `dextuploadx5-react@0.0.1` or later
|
|
25
|
+
- DEXTUploadX5 `4.4.0.0 (beta)` or later through `dextuploadx5-react`
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install dextuploadx5-react-webpack dextuploadx5-react webpack
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import path from "path";
|
|
37
|
+
import { withDEXTUploadX5 } from "dextuploadx5-react-webpack";
|
|
38
|
+
|
|
39
|
+
function createConfig() {
|
|
40
|
+
return {
|
|
41
|
+
entry: "./src/index.jsx",
|
|
42
|
+
output: {
|
|
43
|
+
path: path.resolve(process.cwd(), "dist"),
|
|
44
|
+
filename: "bundle.js",
|
|
45
|
+
clean: true
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default withDEXTUploadX5(createConfig(), {
|
|
51
|
+
publicDir: path.resolve(process.cwd(), "public"),
|
|
52
|
+
dx5DirName: "dx5"
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
With this configuration, the DX5 files are copied automatically so
|
|
57
|
+
`dextuploadx5-react` can load them with `productPath="/dx5/"`.
|
|
58
|
+
|
|
59
|
+
## API
|
|
60
|
+
|
|
61
|
+
### `withDEXTUploadX5(webpackConfig, options?)`
|
|
62
|
+
|
|
63
|
+
Returns a Webpack config with DX5 copy and serving behavior applied.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const config = withDEXTUploadX5(baseConfig, options);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Options
|
|
70
|
+
|
|
71
|
+
#### `from?: string`
|
|
72
|
+
|
|
73
|
+
Source DX5 directory.
|
|
74
|
+
|
|
75
|
+
- Default: `node_modules/dextuploadx5-react/dist/dx5`
|
|
76
|
+
|
|
77
|
+
#### `dx5DirName?: string`
|
|
78
|
+
|
|
79
|
+
Directory name used in output paths and URLs.
|
|
80
|
+
|
|
81
|
+
- Default: `"dx5"`
|
|
82
|
+
|
|
83
|
+
#### `to?: string`
|
|
84
|
+
|
|
85
|
+
Target directory inside the Webpack output when `emitToOutput` is enabled.
|
|
86
|
+
|
|
87
|
+
- Default: same value as `dx5DirName`
|
|
88
|
+
|
|
89
|
+
#### `emitToOutput?: boolean`
|
|
90
|
+
|
|
91
|
+
Copies DX5 files into the Webpack output using `copy-webpack-plugin`.
|
|
92
|
+
|
|
93
|
+
- Default: `true`
|
|
94
|
+
|
|
95
|
+
#### `publicDir?: string`
|
|
96
|
+
|
|
97
|
+
Absolute path of an external public directory.
|
|
98
|
+
|
|
99
|
+
When set, the helper copies DX5 files to `publicDir/<dx5DirName>` and also
|
|
100
|
+
registers that directory with `devServer.static`.
|
|
101
|
+
|
|
102
|
+
This is useful when your application serves `productPath` from a public static
|
|
103
|
+
directory such as `public/dx5`.
|
|
104
|
+
|
|
105
|
+
## Typical Usage
|
|
106
|
+
|
|
107
|
+
### Copy DX5 files into the Webpack output
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import { withDEXTUploadX5 } from "dextuploadx5-react-webpack";
|
|
111
|
+
|
|
112
|
+
export default withDEXTUploadX5(baseConfig);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Copy DX5 files into `public/dx5`
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import path from "path";
|
|
119
|
+
import { withDEXTUploadX5 } from "dextuploadx5-react-webpack";
|
|
120
|
+
|
|
121
|
+
export default withDEXTUploadX5(baseConfig, {
|
|
122
|
+
publicDir: path.resolve(process.cwd(), "public"),
|
|
123
|
+
dx5DirName: "dx5"
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Notes
|
|
128
|
+
|
|
129
|
+
- This package is a build-time helper. It does not replace `dextuploadx5-react`.
|
|
130
|
+
- DX5 files are resolved from the installed `dextuploadx5-react` package first.
|
|
131
|
+
- If `dextuploadx5-react` cannot be resolved automatically, the helper falls back to `process.cwd()/node_modules/dextuploadx5-react/dist/dx5`.
|
|
132
|
+
- The purpose of this package is to remove the need to manage DX5 static file copying manually in Webpack projects.
|
|
133
|
+
- DEXTUploadX5 itself is not distributed through npm, so its required version is documented here instead of `package.json`.
|
|
134
|
+
|
|
135
|
+
## Compatibility
|
|
136
|
+
|
|
137
|
+
| `dextuploadx5-react-webpack` | Minimum `dextuploadx5-react` | Minimum DEXTUploadX5 version |
|
|
138
|
+
| --- | --- | --- |
|
|
139
|
+
| `0.0.1` | `0.0.1` | `4.4.0.0 (beta)` |
|
|
140
|
+
|
|
141
|
+
## History
|
|
142
|
+
|
|
143
|
+
### 0.0.1
|
|
144
|
+
|
|
145
|
+
- Initial package release
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
This package is free to use, including commercial use.
|
|
150
|
+
Modification for internal use is allowed.
|
|
151
|
+
Redistribution of modified versions is prohibited.
|
|
152
|
+
DEXTUploadX5 itself is a commercial product and is not free to use under the same terms as DEXTUploadX5 React Webpack Helper.
|
|
153
|
+
|
|
154
|
+
See the `LICENSE` file for full terms.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const path=require("path"),fs=require("fs"),CopyWebpackPlugin=require("copy-webpack-plugin"),toArray=t=>Array.isArray(t)?t:t?[t]:[],stripHtmlComments=t=>String(t||"").replace(/<!--[\s\S]*?-->/g,""),escapeRegExp=t=>String(t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function tryResolveReactDx5Dir(){try{const t=require.resolve("dextuploadx5-react"),e=path.dirname(t),r=path.resolve(e,"dx5");if(fs.existsSync(r))return r}catch{}return null}function getDefaultDx5Dir(){const t=tryResolveReactDx5Dir();return t||path.resolve(process.cwd(),"node_modules","dextuploadx5-react","dist","dx5")}async function copyDir(t,e){if(await fs.promises.mkdir(e,{recursive:!0}),"function"==typeof fs.promises.cp)return void await fs.promises.cp(t,e,{recursive:!0,force:!0});const r=await fs.promises.readdir(t,{withFileTypes:!0});await Promise.all(r.map(async r=>{const i=path.join(t,r.name),s=path.join(e,r.name);return r.isDirectory()?copyDir(i,s):r.isSymbolicLink()?fs.promises.copyFile(await fs.promises.realpath(i),s):fs.promises.copyFile(i,s)}))}function addStaticDir(t,e){if(!t||!e)return;const r=toArray(t.static);r.some(t=>path.resolve("string"==typeof t?t:t.directory)===path.resolve(e))||r.push({directory:e}),t.static=r}class CopyDx5ToPublicPlugin{constructor({fromDir:t,publicDir:e,dx5DirName:r}){this.fromDir=t,this.publicDir=e,this.dx5DirName=r,this.name="CopyDx5ToPublicPlugin"}apply(t){const e=t.getInfrastructureLogger("dextuploadx5-react-webpack"),r=async()=>{try{await fs.promises.access(this.fromDir)}catch(t){throw new Error(`[dextuploadx5-react-webpack] dx5 source not found: ${this.fromDir}. Install dextuploadx5-react (it ships dist/dx5), or pass { from: <path> }.`)}const t=path.resolve(this.publicDir,this.dx5DirName);await copyDir(this.fromDir,t),e.info(`Copied dx5 resources to ${t}`)};t.hooks.beforeRun.tapPromise(this.name,r),t.hooks.watchRun.tapPromise(this.name,r)}}class InjectDx5ScriptsPlugin{constructor({dx5DirName:t}){this.dx5DirName=t,this.name="InjectDx5ScriptsPlugin"}apply(t){const e=t.getInfrastructureLogger("dextuploadx5-react-webpack");let r;try{r=require("html-webpack-plugin")}catch(t){return void e.warn("[dextuploadx5-react-webpack] injectScripts=true but html-webpack-plugin is not installed. Skipping HTML <script> injection. Install html-webpack-plugin or add the <script> tags manually.")}"function"==typeof r.getHooks?t.hooks.compilation.tap(this.name,t=>{r.getHooks(t).beforeEmit.tap(this.name,t=>{const e=`/${this.dx5DirName}/dextuploadx5-configuration.js`,r=`/${this.dx5DirName}/dextuploadx5.js`,i=stripHtmlComments(t.html),s=t=>new RegExp(`<script[^>]*\\bsrc=["']${escapeRegExp(t)}["']`,"i").test(i),o=[s(e)?"":`<script src="${e}"><\/script>`,s(r)?"":`<script src="${r}"><\/script>`].filter(Boolean);if(0===o.length)return t;const a=o.join("");return t.html=/<\/head>/i.test(t.html)?t.html.replace(/<\/head>/i,`${a}</head>`):t.html+a,t})}):e.warn("[dextuploadx5-react-webpack] injectScripts=true but html-webpack-plugin.getHooks is unavailable. Skipping HTML <script> injection.")}}function withDEXTUploadX5(t,e={}){const r=e||{},i={...t},s=r.from||getDefaultDx5Dir(),o=r.dx5DirName||"dx5",a=r.to||o,p=!1!==r.emitToOutput,c=r.publicDir,n=Boolean(c);if(i.plugins=toArray(i.plugins),p&&i.plugins.push(new CopyWebpackPlugin({patterns:[{from:s,to:a}]})),n){if("string"!=typeof c||!path.isAbsolute(c))throw new Error(`[dextuploadx5-react-webpack] options.publicDir must be an absolute path. Got: ${c}`);i.plugins.push(new CopyDx5ToPublicPlugin({fromDir:s,publicDir:c,dx5DirName:o}))}return addStaticDir(i.devServer,i.output&&i.output.path),n&&addStaticDir(i.devServer,c),i}module.exports={withDEXTUploadX5:withDEXTUploadX5};
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"path";import t from"fs";import{createRequire as o}from"module";import i from"copy-webpack-plugin";const e=o(import.meta.url),s=r=>Array.isArray(r)?r:r?[r]:[];function a(){const o=function(){try{const o=e.resolve("dextuploadx5-react"),i=r.dirname(o),s=r.resolve(i,"dx5");if(t.existsSync(s))return s}catch{}return null}();return o||r.resolve(process.cwd(),"node_modules","dextuploadx5-react","dist","dx5")}async function p(o,i){if(await t.promises.mkdir(i,{recursive:!0}),"function"==typeof t.promises.cp)return void await t.promises.cp(o,i,{recursive:!0,force:!0});const e=await t.promises.readdir(o,{withFileTypes:!0});await Promise.all(e.map(async e=>{const s=r.join(o,e.name),a=r.join(i,e.name);return e.isDirectory()?p(s,a):e.isSymbolicLink()?t.promises.copyFile(await t.promises.realpath(s),a):t.promises.copyFile(s,a)}))}function n(t,o){if(!t||!o)return;const i=s(t.static);i.some(t=>r.resolve("string"==typeof t?t:t.directory)===r.resolve(o))||i.push({directory:o}),t.static=i}class c{constructor({fromDir:r,publicDir:t,dx5DirName:o}){this.fromDir=r,this.publicDir=t,this.dx5DirName=o,this.name="CopyDx5ToPublicPlugin"}apply(o){const i=o.getInfrastructureLogger("dextuploadx5-react-webpack"),e=async()=>{try{await t.promises.access(this.fromDir)}catch{throw new Error(`[dextuploadx5-react-webpack] dx5 source not found: ${this.fromDir}. Install dextuploadx5-react (it ships dist/dx5), or pass { from: <path> }.`)}const o=r.resolve(this.publicDir,this.dx5DirName);await p(this.fromDir,o),i.info(`Copied dx5 resources to ${o}`)};o.hooks.beforeRun.tapPromise(this.name,e),o.hooks.watchRun.tapPromise(this.name,e)}}export function withDEXTUploadX5(t,o={}){const e=o||{},p={...t},u=e.from||a(),m=e.dx5DirName||"dx5",l=e.to||m,d=!1!==e.emitToOutput,f=e.publicDir,h=Boolean(f);if(p.plugins=s(p.plugins),d&&p.plugins.push(new i({patterns:[{from:u,to:l}]})),h){if("string"!=typeof f||!r.isAbsolute(f))throw new Error(`[dextuploadx5-react-webpack] options.publicDir must be an absolute path. Got: ${f}`);p.plugins.push(new c({fromDir:u,publicDir:f,dx5DirName:m}))}return n(p.devServer,p.output&&p.output.path),h&&n(p.devServer,f),p}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dextuploadx5-react-webpack",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "React Webpack helper for dextuploadx5-react (serves DX5 static resources)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"DEXTSolution",
|
|
8
|
+
"DEXTUploadX5",
|
|
9
|
+
"X5",
|
|
10
|
+
"React",
|
|
11
|
+
"Webpack",
|
|
12
|
+
"dextsolution",
|
|
13
|
+
"dextuploadx5",
|
|
14
|
+
"x5",
|
|
15
|
+
"react",
|
|
16
|
+
"webpack"
|
|
17
|
+
],
|
|
18
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
19
|
+
"homepage": "http://www.dextsolution.com",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**"
|
|
22
|
+
],
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "node ./build.mjs",
|
|
32
|
+
"build:debug": "node ./build.mjs --sourcemap",
|
|
33
|
+
"clean": "rimraf dist",
|
|
34
|
+
"pack": "npm run clean && npm run build && npm pack --pack-destination ../distribution"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"copy-webpack-plugin": "^14.0.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"dextuploadx5-react": ">=0.0.1",
|
|
41
|
+
"webpack": ">=5"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"rimraf": "^6.0.1",
|
|
45
|
+
"terser": "^5.43.1"
|
|
46
|
+
}
|
|
47
|
+
}
|