Skip to content

Commit

Permalink
fix(serialization): patch webpack serialization to handle [preserveMo…
Browse files Browse the repository at this point in the history
…duleName]

- Add a test for build with file system cache enabled
- Add extra serialization to `IncludeDependency`
  • Loading branch information
bigopon authored May 6, 2022
2 parents 30c6598 + c41ce6c commit 6a08665
Show file tree
Hide file tree
Showing 23 changed files with 678 additions and 17 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
run: |
npm ci
npx link-parent-bin -c tests
- name: Test build basic app
working-directory: ./tests/app-basic
Expand Down Expand Up @@ -46,6 +48,15 @@ jobs:
npm run build:ci
../../node_modules/.bin/karma.cmd start --singleRun
- name: Test caching
working-directory: ./tests/app-filesystem-cache
run: |
npm run build:ci
npm run test
# run it twice to to use cache 2nd run (hopefully?)
npm run test
Write-Host ( Get-ChildItem .\node_modules\.bin | Measure-Object ).Count;
# - name: Test build app using 3rd party lib
# working-directory: ./tests/app-plugin-3rd-party
# run: npm run build:ci
Expand Down Expand Up @@ -73,9 +84,14 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: |
npm ci
npx link-parent-bin -c tests
- name: Prepare test PNPM
run: |
npm i -g pnpm
npm i -g pnpm@6
pnpm install
- name: Test build basic app with PNPM
Expand Down
17 changes: 17 additions & 0 deletions dist/ClassSerializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassSerializer = void 0;
class ClassSerializer {
constructor(ctor) {
this.ctor = ctor;
}
serialize(obj, context) {
obj.serialize(context);
}
deserialize(context) {
const obj = new this.ctor();
obj.deserialize(context);
return obj;
}
}
exports.ClassSerializer = ClassSerializer;
14 changes: 14 additions & 0 deletions dist/types/ClassSerializer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ObjectDeserializerContext, ObjectSerializerContext } from "./webpack";
export declare class ClassSerializer<T extends ISerializable> {
private ctor;
constructor(ctor: {
new (...params: any[]): T;
});
serialize(obj: T, context: ObjectSerializerContext): void;
deserialize(context: ObjectDeserializerContext): T;
}
interface ISerializable {
serialize(context: ObjectSerializerContext): void;
deserialize(context: ObjectDeserializerContext): void;
}
export {};
Loading

0 comments on commit 6a08665

Please sign in to comment.