Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register dependency serializers #205

Merged
merged 17 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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