@razerspine/webpack-core 1.7.1 → 1.7.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/CHANGELOG.md CHANGED
@@ -8,7 +8,33 @@ required to ensure correct behavior in both development and production modes.
8
8
 
9
9
  ---
10
10
 
11
- ## [1.7.0] - 2026-02-20
11
+ ## [1.7.2] - 2026-02-22
12
+
13
+ ### Added
14
+
15
+ - **Universal Pug Loading Strategy**
16
+ - Introduced `pugRule()` with `oneOf` logic to handle different Pug contexts.
17
+ - **Component Support**: Pug files imported via JS/TS are now compiled into functions (`method: 'compile'`), enabling
18
+ Angular-like component architecture.
19
+ - **Static Entry Support**: Pug files used as entry points continue to render as static HTML (`method: 'render'`).
20
+ - This dual-mode approach ensures SPA components work seamlessly without breaking existing MPA templates.
21
+ - **Dynamic SPA Routing Infrastructure**
22
+ - Added support for client-side routing by decoupling Pug templates from the global layout in SPA mode.
23
+ - Enabled support for `document.title` updates and `data-link` interception within the starter templates.
24
+
25
+ ### Changed
26
+
27
+ - **Refactored** `templatesLoader`
28
+ - Decoupled loader logic from the `PugPlugin` instance.
29
+ - Removed global `loaderOptions` from `PugPlugin` to delegate responsibility to the new specialized `pugRule()`.
30
+ - Improved compatibility between dynamic imports and static page generation.
31
+ - **Clean Architecture Alignment**
32
+ - Updated `base.ts` to include `pugRule()` in `module.rules`, establishing a standard for how assets are resolved across all 8
33
+ - template variations (JS/TS, SCSS/Less, MPA/SPA).
34
+
35
+ ---
36
+
37
+ ## [1.7.1] - 2026-02-22
12
38
 
13
39
  ### Added
14
40
 
package/README.md CHANGED
@@ -29,12 +29,12 @@ Can be used independently in any Pug-based project.
29
29
  - Recursive file watching (`src/**/*`)
30
30
  - SPA-friendly dev server
31
31
  - Config validation layer
32
- - Centralized options normalization (v1.7.0+)
32
+ - Centralized options normalization (v1.7.1+)
33
33
  - Fully customizable dev & prod configs
34
34
 
35
35
  ---
36
36
 
37
- ## Application Modes (v1.7.0+)
37
+ ## Application Modes (v1.7.1+)
38
38
 
39
39
  ### MPA (Default)
40
40
 
@@ -63,10 +63,10 @@ appType: 'spa'
63
63
  - **Webpack is responsible for**: module resolution, aliases (`resolve.alias`), and asset handling.
64
64
  - **Template-driven architecture**: Webpack JS entry is intentionally disabled. Builds are driven by Pug template entries.
65
65
  - **MPA by default**: Directory-based page generation remains the primary mode.
66
- - **Optional SPA support (v1.7.0+)**: Single-entry template mode is supported without breaking MPA workflow.
66
+ - **Optional SPA support (v1.7.1+)**: Single-entry template mode is supported without breaking MPA workflow.
67
67
  - **Stability-first production defaults**: No aggressive optimizations (e.g. `splitChunks`) are enabled by default to prevent template asset resolution issues.
68
68
  - **Validated configuration layer**: Core options are validated before Webpack initialization.
69
- - **Centralized option normalization (v1.7.0+)**: Default resolution is handled internally through a normalization layer to avoid configuration drift.
69
+ - **Centralized option normalization (v1.7.1+)**: Default resolution is handled internally through a normalization layer to avoid configuration drift.
70
70
  - **Flexible overrides**: Dev and Prod configs can be extended safely via optional parameters.
71
71
 
72
72
  ---
@@ -163,7 +163,7 @@ if (mode === 'production') {
163
163
  - No implicit webpack JS entry
164
164
  - No aggressive production optimizations by default
165
165
  - Options validated before build initialization
166
- - Defaults resolved through a normalization layer (v1.7.0+)
166
+ - Defaults resolved through a normalization layer (v1.7.1+)
167
167
 
168
168
  ---
169
169
 
@@ -65,6 +65,21 @@ export declare function createBaseConfig(options: ConfigOptionType): {
65
65
  postcssOptions?: undefined;
66
66
  };
67
67
  })[];
68
+ } | {
69
+ test: RegExp;
70
+ oneOf: ({
71
+ issuer: RegExp;
72
+ loader: any;
73
+ options: {
74
+ method: string;
75
+ };
76
+ } | {
77
+ loader: any;
78
+ options: {
79
+ method: string;
80
+ };
81
+ issuer?: undefined;
82
+ })[];
68
83
  })[];
69
84
  };
70
85
  plugins: any[];
@@ -24,6 +24,7 @@ function createBaseConfig(options) {
24
24
  },
25
25
  module: {
26
26
  rules: [
27
+ (0, templates_1.pugRule)(),
27
28
  (0, assets_1.assetsLoader)(),
28
29
  (0, scripts_1.scriptsLoader)(normalized),
29
30
  (0, styles_1.stylesLoader)(normalized),
@@ -1,5 +1,21 @@
1
1
  import { ModeType } from '../types/mode-type';
2
2
  import { AppType } from '../types/app-type';
3
+ export declare function pugRule(): {
4
+ test: RegExp;
5
+ oneOf: ({
6
+ issuer: RegExp;
7
+ loader: any;
8
+ options: {
9
+ method: string;
10
+ };
11
+ } | {
12
+ loader: any;
13
+ options: {
14
+ method: string;
15
+ };
16
+ issuer?: undefined;
17
+ })[];
18
+ };
3
19
  export declare function templatesLoader(options: {
4
20
  entry: string;
5
21
  mode: ModeType;
@@ -3,9 +3,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.pugRule = pugRule;
6
7
  exports.templatesLoader = templatesLoader;
7
8
  const pug_plugin_1 = __importDefault(require("pug-plugin"));
8
9
  const fs_1 = __importDefault(require("fs"));
10
+ function pugRule() {
11
+ return {
12
+ test: /\.pug$/,
13
+ oneOf: [
14
+ {
15
+ issuer: /\.(js|ts|tsx|jsx)$/,
16
+ loader: pug_plugin_1.default.loader,
17
+ options: {
18
+ method: 'compile',
19
+ },
20
+ },
21
+ {
22
+ loader: pug_plugin_1.default.loader,
23
+ options: {
24
+ method: 'render',
25
+ },
26
+ },
27
+ ],
28
+ };
29
+ }
9
30
  function templatesLoader(options) {
10
31
  const { entry, appType } = options;
11
32
  if (!fs_1.default.existsSync(entry)) {
@@ -22,9 +43,6 @@ function templatesLoader(options) {
22
43
  return [
23
44
  new pug_plugin_1.default({
24
45
  entry: pluginEntry,
25
- loaderOptions: {
26
- method: 'compile'
27
- },
28
46
  filename: ({ chunk }) => {
29
47
  if (appType === 'spa') {
30
48
  return 'index.html';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razerspine/webpack-core",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Core webpack config and loaders for starter templates",
5
5
  "keywords": [
6
6
  "webpack",