Skip to content

Commit

Permalink
Merge pull request #15 from x0k/php-update
Browse files Browse the repository at this point in the history
Php update
  • Loading branch information
x0k authored Aug 19, 2024
2 parents d2ae9a3 + 60717c8 commit ee5ef70
Show file tree
Hide file tree
Showing 15 changed files with 970 additions and 259 deletions.
4 changes: 2 additions & 2 deletions apps/ppp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.2",
"@astrojs/check": "^0.9.3",
"@astrojs/mdx": "^3.1.3",
"@astrojs/svelte": "^5.7.0",
"@astrojs/tailwind": "^5.1.0",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@types/color": "^3.0.6",
"color": "^4.2.3",
"daisyui": "^4.12.10",
"svelte": "5.0.0-next.224",
"svelte": "5.0.0-next.225",
"vite-plugin-cross-origin-isolation": "^0.1.6",
"vite-plugin-static-copy": "^1.0.6"
}
Expand Down
9 changes: 4 additions & 5 deletions apps/ppp/src/adapters/runtime/php/test-compiler-factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inContext, type Context } from 'libs/context';
import type { Writer } from "libs/io";
import { FailSafePHP, phpRuntimeFactory, PHPTestProgram } from "php-runtime";
import { phpCompilerFactory, PHPTestProgram } from "php-runtime";
import type { TestCompiler } from "testing";

export type GenerateCaseExecutionCode<I> = (input: I) => string;
Expand All @@ -17,17 +17,16 @@ export class PhpTestCompilerFactory {
return generateCaseExecutionCode(data);
}
}
const failSafePhp = new FailSafePHP(phpRuntimeFactory);
await inContext(ctx, failSafePhp.failSafeInit());
const php = await inContext(ctx, phpCompilerFactory());
return {
compile: async (_, files) => {
if (files.length !== 1) {
throw new Error("Compilation of multiple files is not implemented");
}
return new TestProgram(this.out, failSafePhp, files[0].content);
return new TestProgram(this.out, php, files[0].content);
},
[Symbol.dispose]() {
failSafePhp[Symbol.dispose]();
php[Symbol.dispose]();
},
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/dotnet-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"testing": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2",
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3",
"vite-plugin-static-copy": "^1.0.6"
},
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/gleam-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"libs": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2",
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3",
"vite-plugin-static-copy": "^1.0.6"
},
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/go-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"devDependencies": {
"@types/golang-wasm-exec": "^1.15.2",
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2"
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3"
},
"exports": {
".": "./dist/index.js",
Expand Down
7 changes: 4 additions & 3 deletions packages/php-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"build": "vite build"
},
"dependencies": {
"@php-wasm/web": "^0.7.20",
"@php-wasm/universal": "^0.9.30",
"@php-wasm/web": "^0.9.30",
"libs": "workspace:*",
"testing": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2"
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3"
},
"exports": {
".": "./dist/index.js",
Expand Down
28 changes: 0 additions & 28 deletions packages/php-runtime/src/fail-safe-php.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/php-runtime/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./php-test-program";
export * from "./fail-safe-php";
export * from "./php-runtime-factory";
export * from "./php-compiler-factory";
export * from "./version";
8 changes: 8 additions & 0 deletions packages/php-runtime/src/php-compiler-factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { loadPHPRuntime, PHP } from '@php-wasm/universal'
// @ts-expect-error hack
import * as phpModule from "@php-wasm/web/light/php_8_3.js";

export async function phpCompilerFactory () {
const phpRuntime = await loadPHPRuntime(phpModule)
return new PHP(phpRuntime)
}
12 changes: 0 additions & 12 deletions packages/php-runtime/src/php-runtime-factory.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/php-runtime/src/php-test-program.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WebPHP } from "@php-wasm/web";
import type { PHP } from "@php-wasm/universal";

import type { Writer } from "libs/io";
import type { Context } from "libs/context";
Expand All @@ -9,7 +9,7 @@ export abstract class PHPTestProgram<I, O> implements TestProgram<I, O> {

constructor(
protected writer: Writer,
protected readonly php: WebPHP,
protected readonly php: PHP,
protected readonly code: string
) {
php.onMessage(this.handleResult.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion packages/php-runtime/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "8.3";
export const version = "8.3.0";
4 changes: 2 additions & 2 deletions packages/python-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"testing": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2",
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3",
"vite-plugin-static-copy": "^1.0.6"
},
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/rust-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"testing": "workspace:*"
},
"devDependencies": {
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.2"
"vite": "^5.4.1",
"vite-plugin-dts": "^4.0.3"
},
"exports": {
".": "./dist/index.js",
Expand Down
Loading

0 comments on commit ee5ef70

Please sign in to comment.