@razerspine/webpack-core 1.0.0 → 1.0.2
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/README.md +19 -1
- package/dist/config/base.d.ts +5 -11
- package/dist/config/base.js +9 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/loaders/scripts.d.ts +2 -2
- package/dist/loaders/scripts.js +1 -1
- package/dist/loaders/styles.d.ts +2 -2
- package/dist/loaders/styles.js +1 -1
- package/dist/types/{loader-type.d.ts → config-option-type.d.ts} +8 -5
- package/package.json +1 -1
- /package/dist/types/{loader-type.js → config-option-type.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# @razerspine/webpack-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
Core webpack configuration and loaders for modern Pug-based projects.
|
|
5
|
+
|
|
6
|
+
## Designed for
|
|
7
|
+
|
|
8
|
+
This package is developed as part of the
|
|
9
|
+
[Webpack Starter Monorepo](https://github.com/Razerspine/webpack-starter-monorepo).
|
|
10
|
+
|
|
11
|
+
It provides shared webpack configuration and loaders used by the
|
|
12
|
+
starter templates, but can also be used independently in custom setups.
|
|
4
13
|
|
|
5
14
|
## Features
|
|
6
15
|
|
|
@@ -10,6 +19,11 @@ Core webpack configurations and loaders for starter templates
|
|
|
10
19
|
- Environment-aware loaders
|
|
11
20
|
- No aliases or UI-kit hardcoded
|
|
12
21
|
|
|
22
|
+
## Installation
|
|
23
|
+
```bash
|
|
24
|
+
npm i @razerspine/webpack-core
|
|
25
|
+
```
|
|
26
|
+
|
|
13
27
|
## Usage
|
|
14
28
|
|
|
15
29
|
```js
|
|
@@ -40,3 +54,7 @@ module.exports = (env, argv) => {
|
|
|
40
54
|
: createProdConfig())
|
|
41
55
|
};
|
|
42
56
|
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 📄 License
|
|
60
|
+
This project is licensed under the ISC License.
|
package/dist/config/base.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
entry?: string;
|
|
7
|
-
};
|
|
8
|
-
}): {
|
|
9
|
-
mode: import("..").ModeType;
|
|
10
|
-
context: string;
|
|
1
|
+
import { ModeType } from '../types/mode-type';
|
|
2
|
+
import { ConfigOptionType } from '../types/config-option-type';
|
|
3
|
+
export declare function createBaseConfig(options: ConfigOptionType): {
|
|
4
|
+
mode: ModeType;
|
|
5
|
+
entry: undefined;
|
|
11
6
|
output: {
|
|
12
|
-
path: string;
|
|
13
7
|
clean: boolean;
|
|
14
8
|
};
|
|
15
9
|
module: {
|
package/dist/config/base.js
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createBaseConfig = createBaseConfig;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
4
|
const assets_1 = require("../loaders/assets");
|
|
9
5
|
const scripts_1 = require("../loaders/scripts");
|
|
10
6
|
const styles_1 = require("../loaders/styles");
|
|
11
7
|
const templates_1 = require("../loaders/templates");
|
|
12
8
|
function createBaseConfig(options) {
|
|
13
|
-
var _a;
|
|
14
|
-
const
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : 'development';
|
|
15
11
|
return {
|
|
16
|
-
mode
|
|
17
|
-
|
|
12
|
+
mode,
|
|
13
|
+
entry: undefined,
|
|
18
14
|
output: {
|
|
19
|
-
|
|
20
|
-
clean: true
|
|
15
|
+
clean: true,
|
|
21
16
|
},
|
|
22
17
|
module: {
|
|
23
18
|
rules: [
|
|
24
19
|
(0, assets_1.assetsLoader)(),
|
|
25
|
-
(0, scripts_1.scriptsLoader)(
|
|
26
|
-
(0, styles_1.stylesLoader)(
|
|
20
|
+
(0, scripts_1.scriptsLoader)(options),
|
|
21
|
+
(0, styles_1.stylesLoader)(options)
|
|
27
22
|
]
|
|
28
23
|
},
|
|
29
24
|
plugins: [
|
|
30
25
|
...(0, templates_1.templatesLoader)({
|
|
31
|
-
entry: (
|
|
32
|
-
mode:
|
|
26
|
+
entry: (_b = options.templates) === null || _b === void 0 ? void 0 : _b.entry,
|
|
27
|
+
mode: options.mode
|
|
33
28
|
})
|
|
34
29
|
],
|
|
35
30
|
resolve: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createBaseConfig } from './config/base';
|
|
2
2
|
export { createDevConfig } from './config/dev';
|
|
3
3
|
export { createProdConfig } from './config/prod';
|
|
4
|
-
export * from './types/loader-type';
|
|
5
4
|
export * from './types/mode-type';
|
|
6
5
|
export * from './types/script-type';
|
|
7
6
|
export * from './types/style-type';
|
|
7
|
+
export * from './types/config-option-type';
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var dev_1 = require("./config/dev");
|
|
|
21
21
|
Object.defineProperty(exports, "createDevConfig", { enumerable: true, get: function () { return dev_1.createDevConfig; } });
|
|
22
22
|
var prod_1 = require("./config/prod");
|
|
23
23
|
Object.defineProperty(exports, "createProdConfig", { enumerable: true, get: function () { return prod_1.createProdConfig; } });
|
|
24
|
-
__exportStar(require("./types/loader-type"), exports);
|
|
25
24
|
__exportStar(require("./types/mode-type"), exports);
|
|
26
25
|
__exportStar(require("./types/script-type"), exports);
|
|
27
26
|
__exportStar(require("./types/style-type"), exports);
|
|
27
|
+
__exportStar(require("./types/config-option-type"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function scriptsLoader(env:
|
|
1
|
+
import { ConfigOptionType } from '../types/config-option-type';
|
|
2
|
+
export declare function scriptsLoader(env: ConfigOptionType): {
|
|
3
3
|
test: RegExp;
|
|
4
4
|
exclude: RegExp;
|
|
5
5
|
use: {
|
package/dist/loaders/scripts.js
CHANGED
package/dist/loaders/styles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function stylesLoader(env:
|
|
1
|
+
import { ConfigOptionType } from '../types/config-option-type';
|
|
2
|
+
export declare function stylesLoader(env: ConfigOptionType): {
|
|
3
3
|
test: RegExp;
|
|
4
4
|
use: (string | {
|
|
5
5
|
loader: string;
|
package/dist/loaders/styles.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stylesLoader = stylesLoader;
|
|
4
4
|
function stylesLoader(env) {
|
|
5
|
-
const isLess = env.
|
|
5
|
+
const isLess = env.styles === 'less';
|
|
6
6
|
return {
|
|
7
7
|
test: isLess ? /\.(css|less)$/ : /\.(css|scss|sass)$/,
|
|
8
8
|
use: [
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ModeType } from './mode-type';
|
|
2
|
-
import { StyleType } from './style-type';
|
|
3
2
|
import { ScriptType } from './script-type';
|
|
4
|
-
|
|
3
|
+
import { StyleType } from './style-type';
|
|
4
|
+
export type ConfigOptionType = {
|
|
5
5
|
mode: ModeType;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
scripts: ScriptType;
|
|
7
|
+
styles: StyleType;
|
|
8
|
+
templates: {
|
|
9
|
+
entry: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
package/package.json
CHANGED
|
File without changes
|