Skip to content

Commit

Permalink
Update samples to latest component model (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeumer authored Aug 26, 2024
1 parent 0e6ef61 commit a11599c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
8 changes: 4 additions & 4 deletions wasm-component-model-async/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm-component-model-async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
"dependencies": {
"@vscode/wasm-component-model": "0.1.0-pre.13"
"@vscode/wasm-component-model": "0.1.0-pre.16"
},
"devDependencies": {
"@types/vscode": "1.89.0",
Expand Down
13 changes: 7 additions & 6 deletions wasm-component-model-async/src/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ export type Types = {
};
export namespace calculator {
export type Operation = Types.Operation;
export const Operation = Types.Operation;
export type Imports = {
log: (msg: string) => void;
};
export namespace Imports {
export type Promisified = $wcm.$imports.Promisify<Imports>
export type Promisified = $wcm.$imports.Promisify<Imports>;
}
export namespace imports {
export type Promisify<T> = $wcm.$imports.Promisify<T>;
Expand All @@ -89,7 +90,7 @@ export namespace calculator {
calc: (o: Operation) => u32;
};
export namespace Exports {
export type Promisified = $wcm.$exports.Promisify<Exports>
export type Promisified = $wcm.$exports.Promisify<Exports>;
}
export namespace exports {
export type Promisify<T> = $wcm.$exports.Promisify<T>;
Expand All @@ -106,7 +107,7 @@ export namespace Types.$ {
export namespace Types._ {
export const id = 'vscode:example/types' as const;
export const witName = 'types' as const;
export const types: Map<string, $wcm.GenericComponentModelType> = new Map<string, $wcm.GenericComponentModelType>([
export const types: Map<string, $wcm.AnyComponentModelType> = new Map<string, $wcm.AnyComponentModelType>([
['Operands', $.Operands],
['Operation', $.Operation]
]);
Expand Down Expand Up @@ -143,7 +144,7 @@ export namespace calculator._ {
return $wcm.$imports.create<Imports>(_, service, context);
}
export function loop(service: calculator.Imports, context: $wcm.WasmContext): calculator.Imports {
return $wcm.$imports.loop(_, service, context);
return $wcm.$imports.loop<calculator.Imports>(_, service, context);
}
}
export type Imports = {
Expand All @@ -161,8 +162,8 @@ export namespace calculator._ {
'calc': (o_Operation_case: i32, o_Operation_0: i32, o_Operation_1: i32) => i32;
};
export function bind(service: calculator.Imports, code: $wcm.Code, context?: $wcm.ComponentModelContext): Promise<calculator.Exports>;
export function bind(service: $wcm.$imports.Promisify<calculator.Imports>, code: $wcm.Code, port: $wcm.RAL.ConnectionPort, context?: $wcm.ComponentModelContext): Promise<$wcm.$exports.Promisify<calculator.Exports>>;
export function bind(service: calculator.Imports | $wcm.$imports.Promisify<calculator.Imports>, code: $wcm.Code, portOrContext?: $wcm.RAL.ConnectionPort | $wcm.ComponentModelContext, context?: $wcm.ComponentModelContext | undefined): Promise<calculator.Exports> | Promise<$wcm.$exports.Promisify<calculator.Exports>> {
export function bind(service: calculator.Imports.Promisified, code: $wcm.Code, port: $wcm.RAL.ConnectionPort, context?: $wcm.ComponentModelContext): Promise<calculator.Exports.Promisified>;
export function bind(service: calculator.Imports | calculator.Imports.Promisified, code: $wcm.Code, portOrContext?: $wcm.RAL.ConnectionPort | $wcm.ComponentModelContext, context?: $wcm.ComponentModelContext | undefined): Promise<calculator.Exports> | Promise<calculator.Exports.Promisified> {
return $wcm.$main.bind(_, service, code, portOrContext, context);
}
}
8 changes: 4 additions & 4 deletions wasm-component-model-resource/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm-component-model-resource/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
"dependencies": {
"@vscode/wasm-component-model": "0.1.0-pre.13"
"@vscode/wasm-component-model": "0.1.0-pre.16"
},
"devDependencies": {
"@types/vscode": "1.88.0",
Expand Down
12 changes: 6 additions & 6 deletions wasm-component-model-resource/src/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export namespace calculator {
export type Imports = {
};
export namespace Imports {
export type Promisified = $wcm.$imports.Promisify<Imports>
export type Promisified = $wcm.$imports.Promisify<Imports>;
}
export namespace imports {
export type Promisify<T> = $wcm.$imports.Promisify<T>;
Expand All @@ -47,7 +47,7 @@ export namespace calculator {
types: Types;
};
export namespace Exports {
export type Promisified = $wcm.$exports.Promisify<Exports>
export type Promisified = $wcm.$exports.Promisify<Exports>;
}
export namespace exports {
export type Promisify<T> = $wcm.$exports.Promisify<T>;
Expand Down Expand Up @@ -85,7 +85,7 @@ export namespace Types._ {
export type WasmInterface = Engine.WasmInterface & { '[dtor]engine': (self: i32) => void };
}
}
export const types: Map<string, $wcm.GenericComponentModelType> = new Map<string, $wcm.GenericComponentModelType>([
export const types: Map<string, $wcm.AnyComponentModelType> = new Map<string, $wcm.AnyComponentModelType>([
['Operation', $.Operation],
['Engine', $.Engine]
]);
Expand Down Expand Up @@ -118,7 +118,7 @@ export namespace calculator._ {
return $wcm.$imports.create<Imports>(_, service, context);
}
export function loop(service: calculator.Imports, context: $wcm.WasmContext): calculator.Imports {
return $wcm.$imports.loop(_, service, context);
return $wcm.$imports.loop<calculator.Imports>(_, service, context);
}
}
export type Imports = {
Expand All @@ -139,8 +139,8 @@ export namespace calculator._ {
'vscode:example/types#[method]engine.execute': (self: i32) => i32;
};
export function bind(service: calculator.Imports, code: $wcm.Code, context?: $wcm.ComponentModelContext): Promise<calculator.Exports>;
export function bind(service: $wcm.$imports.Promisify<calculator.Imports>, code: $wcm.Code, port: $wcm.RAL.ConnectionPort, context?: $wcm.ComponentModelContext): Promise<$wcm.$exports.Promisify<calculator.Exports>>;
export function bind(service: calculator.Imports | $wcm.$imports.Promisify<calculator.Imports>, code: $wcm.Code, portOrContext?: $wcm.RAL.ConnectionPort | $wcm.ComponentModelContext, context?: $wcm.ComponentModelContext | undefined): Promise<calculator.Exports> | Promise<$wcm.$exports.Promisify<calculator.Exports>> {
export function bind(service: calculator.Imports.Promisified, code: $wcm.Code, port: $wcm.RAL.ConnectionPort, context?: $wcm.ComponentModelContext): Promise<calculator.Exports.Promisified>;
export function bind(service: calculator.Imports | calculator.Imports.Promisified, code: $wcm.Code, portOrContext?: $wcm.RAL.ConnectionPort | $wcm.ComponentModelContext, context?: $wcm.ComponentModelContext | undefined): Promise<calculator.Exports> | Promise<calculator.Exports.Promisified> {
return $wcm.$main.bind(_, service, code, portOrContext, context);
}
}
8 changes: 4 additions & 4 deletions wasm-component-model/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm-component-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]
},
"dependencies": {
"@vscode/wasm-component-model": "0.1.0-pre.15"
"@vscode/wasm-component-model": "0.1.0-pre.16"
},
"devDependencies": {
"@types/vscode": "1.88.0",
Expand Down
3 changes: 3 additions & 0 deletions wasm-component-model/src/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export namespace calculator._ {
export const functions: Map<string, $wcm.FunctionType> = new Map([
['log', $.imports.log]
]);
export const interfaces: Map<string, $wcm.InterfaceType> = new Map<string, $wcm.InterfaceType>([
['Types', Types._]
]);
export function create(service: calculator.Imports, context: $wcm.WasmContext): Imports {
return $wcm.$imports.create<Imports>(_, service, context);
}
Expand Down

0 comments on commit a11599c

Please sign in to comment.