@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 CHANGED
@@ -1,6 +1,15 @@
1
1
  # @razerspine/webpack-core
2
2
 
3
- Core webpack configurations and loaders for starter templates
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.
@@ -1,15 +1,9 @@
1
- import { LoaderType } from '../types/loader-type';
2
- export declare function createBaseConfig(options: {
3
- root: string;
4
- env: LoaderType;
5
- templates?: {
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: {
@@ -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 { root, env } = options;
9
+ var _a, _b;
10
+ const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : 'development';
15
11
  return {
16
- mode: env.mode,
17
- context: root,
12
+ mode,
13
+ entry: undefined,
18
14
  output: {
19
- path: path_1.default.join(root, 'dist'),
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)(env),
26
- (0, styles_1.stylesLoader)(env)
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: (_a = options.templates) === null || _a === void 0 ? void 0 : _a.entry,
32
- mode: env.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 { LoaderType } from '../types/loader-type';
2
- export declare function scriptsLoader(env: LoaderType): {
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: {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scriptsLoader = scriptsLoader;
4
4
  function scriptsLoader(env) {
5
- if (env.script === 'ts') {
5
+ if (env.scripts === 'ts') {
6
6
  return {
7
7
  test: /\.ts$/,
8
8
  exclude: /node_modules/,
@@ -1,5 +1,5 @@
1
- import { LoaderType } from '../types/loader-type';
2
- export declare function stylesLoader(env: LoaderType): {
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;
@@ -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.style === 'less';
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
- export interface LoaderType {
3
+ import { StyleType } from './style-type';
4
+ export type ConfigOptionType = {
5
5
  mode: ModeType;
6
- script: ScriptType;
7
- style: StyleType;
8
- }
6
+ scripts: ScriptType;
7
+ styles: StyleType;
8
+ templates: {
9
+ entry: string;
10
+ };
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razerspine/webpack-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Core webpack config and loaders for starter templates",
5
5
  "license": "ISC",
6
6
  "author": "Razerspine",