feat!: Update AiScript version from 0.11.1 to 0.13.3
This enables usage of the more modern language features of AiScript 0.12 as well as the new math functions from 0.13. Note that this is a breaking change, as any currently-functioning AiScript plugins, buttons, scripts, etc will need to be updated to work with 0.12+'s new syntax.
This commit is contained in:
parent
4fae29e471
commit
2cc6276b3b
10 changed files with 41 additions and 50 deletions
|
@ -35,7 +35,7 @@
|
|||
"@peertube/http-signature": "1.7.0",
|
||||
"@redocly/openapi-core": "1.0.0-beta.120",
|
||||
"@sinonjs/fake-timers": "9.1.2",
|
||||
"@syuilo/aiscript": "0.11.1",
|
||||
"@syuilo/aiscript": "0.13.3",
|
||||
"@tensorflow/tfjs": "^4.2.0",
|
||||
"adm-zip": "^0.5.10",
|
||||
"ajv": "8.11.2",
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"@rollup/plugin-alias": "3.1.9",
|
||||
"@rollup/plugin-json": "4.1.0",
|
||||
"@rollup/pluginutils": "^4.2.1",
|
||||
"@syuilo/aiscript": "0.11.1",
|
||||
"@syuilo/aiscript": "^0.13.3",
|
||||
"@types/escape-regexp": "0.0.1",
|
||||
"@types/glob": "8.0.0",
|
||||
"@types/gulp": "4.0.10",
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
onUnmounted,
|
||||
PropType,
|
||||
} from "vue";
|
||||
import { parse } from "@syuilo/aiscript";
|
||||
import { Parser } from "@syuilo/aiscript";
|
||||
import XBlock from "./page.block.vue";
|
||||
import { Hpml } from "@/scripts/hpml/evaluator";
|
||||
import { url } from "@/config";
|
||||
|
@ -51,8 +51,9 @@ export default defineComponent({
|
|||
nextTick(() => {
|
||||
if (props.page.script && hpml.aiscript) {
|
||||
let ast;
|
||||
const parser = new Parser()
|
||||
try {
|
||||
ast = parse(props.page.script);
|
||||
ast = parser.parse(props.page.script);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
/*os.alert({
|
||||
|
|
|
@ -45,7 +45,7 @@ import "prismjs/components/prism-javascript";
|
|||
import "prismjs/themes/prism-okaidia.css";
|
||||
import { PrismEditor } from "vue-prism-editor";
|
||||
import "vue-prism-editor/dist/prismeditor.min.css";
|
||||
import { AiScript, parse, utils } from "@syuilo/aiscript";
|
||||
import { Interpreter, Parser, utils } from "@syuilo/aiscript";
|
||||
import MkContainer from "@/components/MkContainer.vue";
|
||||
import MkButton from "@/components/MkButton.vue";
|
||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||
|
@ -68,7 +68,8 @@ watch(code, () => {
|
|||
|
||||
async function run() {
|
||||
logs.value = [];
|
||||
const aiscript = new AiScript(
|
||||
const parser = new Parser()
|
||||
const aiscript = new Interpreter(
|
||||
createAiScriptEnv({
|
||||
storageKey: "scratchpad",
|
||||
token: $i?.token,
|
||||
|
@ -111,7 +112,7 @@ async function run() {
|
|||
|
||||
let ast;
|
||||
try {
|
||||
ast = parse(code.value);
|
||||
ast = parser.parse(code.value);
|
||||
} catch (error) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent, nextTick, ref } from "vue";
|
||||
import { AiScript, parse } from "@syuilo/aiscript";
|
||||
import { serialize } from "@syuilo/aiscript/built/serializer";
|
||||
import { Interpreter, Parser } from "@syuilo/aiscript";
|
||||
import { v4 as uuid } from "uuid";
|
||||
import FormTextarea from "@/components/form/textarea.vue";
|
||||
import FormButton from "@/components/MkButton.vue";
|
||||
|
@ -49,8 +48,9 @@ function installPlugin({ id, meta, ast, token }) {
|
|||
|
||||
async function install() {
|
||||
let ast;
|
||||
const parser = new Parser()
|
||||
try {
|
||||
ast = parse(code.value);
|
||||
ast = parser.parse(code.value);
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
@ -59,7 +59,7 @@ async function install() {
|
|||
return;
|
||||
}
|
||||
|
||||
const meta = AiScript.collectMetadata(ast);
|
||||
const meta = Interpreter.collectMetadata(ast);
|
||||
if (meta == null) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
@ -132,7 +132,7 @@ async function install() {
|
|||
config,
|
||||
},
|
||||
token,
|
||||
ast: serialize(ast),
|
||||
ast: ast,
|
||||
});
|
||||
|
||||
os.success();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { AiScript, utils, values } from "@syuilo/aiscript";
|
||||
import { deserialize } from "@syuilo/aiscript/built/serializer";
|
||||
import { Interpreter, utils, values } from "@syuilo/aiscript";
|
||||
import { jsToVal } from "@syuilo/aiscript/built/interpreter/util";
|
||||
import { createAiScriptEnv } from "@/scripts/aiscript/api";
|
||||
import { inputText } from "@/os";
|
||||
|
@ -11,12 +10,12 @@ import {
|
|||
userActions,
|
||||
} from "@/store";
|
||||
|
||||
const pluginContexts = new Map<string, AiScript>();
|
||||
const pluginContexts = new Map<string, Interpreter>();
|
||||
|
||||
export function install(plugin) {
|
||||
console.info("Plugin installed:", plugin.name, `v${plugin.version}`);
|
||||
|
||||
const aiscript = new AiScript(
|
||||
const aiscript = new Interpreter(
|
||||
createPluginEnv({
|
||||
plugin: plugin,
|
||||
storageKey: `plugins:${plugin.id}`,
|
||||
|
@ -40,7 +39,7 @@ export function install(plugin) {
|
|||
|
||||
initPlugin({ plugin, aiscript });
|
||||
|
||||
aiscript.exec(deserialize(plugin.ast));
|
||||
aiscript.exec(plugin.ast);
|
||||
}
|
||||
|
||||
function createPluginEnv(opts) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import autobind from "autobind-decorator";
|
||||
import { PageVar, envVarsDef, Fn, HpmlScope, HpmlError } from ".";
|
||||
import { version } from "@/config";
|
||||
import { AiScript, utils, values } from "@syuilo/aiscript";
|
||||
import { Interpreter, utils, values } from "@syuilo/aiscript";
|
||||
import { createAiScriptEnv } from "../aiscript/api";
|
||||
import { collectPageVars } from "../collect-page-vars";
|
||||
import { initHpmlLib, initAiLib } from "./lib";
|
||||
|
@ -16,7 +16,7 @@ export class Hpml {
|
|||
private variables: Variable[];
|
||||
private pageVars: PageVar[];
|
||||
private envVars: Record<keyof typeof envVarsDef, any>;
|
||||
public aiscript?: AiScript;
|
||||
public aiscript?: Interpreter;
|
||||
public pageVarUpdatedCallback?: values.VFn;
|
||||
public canvases: Record<string, HTMLCanvasElement> = {};
|
||||
public vars: Ref<Record<string, any>> = ref({});
|
||||
|
@ -37,7 +37,7 @@ export class Hpml {
|
|||
|
||||
if (this.opts.enableAiScript) {
|
||||
this.aiscript = markRaw(
|
||||
new AiScript(
|
||||
new Interpreter(
|
||||
{
|
||||
...createAiScriptEnv({
|
||||
storageKey: `pages:${this.page.id}`,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { AiScript, parse, utils } from "@syuilo/aiscript";
|
||||
import { Interpreter, Parser, utils } from "@syuilo/aiscript";
|
||||
import {
|
||||
useWidgetPropsManager,
|
||||
Widget,
|
||||
|
@ -82,7 +82,7 @@ const logs = ref<
|
|||
|
||||
const run = async () => {
|
||||
logs.value = [];
|
||||
const aiscript = new AiScript(
|
||||
const aiscript = new Interpreter(
|
||||
createAiScriptEnv({
|
||||
storageKey: "widget",
|
||||
token: $i?.token,
|
||||
|
@ -124,8 +124,9 @@ const run = async () => {
|
|||
);
|
||||
|
||||
let ast;
|
||||
const parser = new Parser()
|
||||
try {
|
||||
ast = parse(widgetProps.script);
|
||||
ast = parser.parse(widgetProps.script);
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { AiScript, parse, utils } from "@syuilo/aiscript";
|
||||
import { Interpreter, Parser, utils } from "@syuilo/aiscript";
|
||||
import {
|
||||
useWidgetPropsManager,
|
||||
Widget,
|
||||
|
@ -56,7 +56,7 @@ const { widgetProps, configure } = useWidgetPropsManager(
|
|||
);
|
||||
|
||||
const run = async () => {
|
||||
const aiscript = new AiScript(
|
||||
const aiscript = new Interpreter(
|
||||
createAiScriptEnv({
|
||||
storageKey: "widget",
|
||||
token: $i?.token,
|
||||
|
@ -81,8 +81,9 @@ const run = async () => {
|
|||
);
|
||||
|
||||
let ast;
|
||||
const parser = new Parser()
|
||||
try {
|
||||
ast = parse(widgetProps.script);
|
||||
ast = parser.parse(widgetProps.script);
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: "error",
|
||||
|
|
|
@ -114,8 +114,8 @@ importers:
|
|||
specifier: 9.1.2
|
||||
version: 9.1.2
|
||||
'@syuilo/aiscript':
|
||||
specifier: 0.11.1
|
||||
version: 0.11.1
|
||||
specifier: 0.13.3
|
||||
version: 0.13.3
|
||||
'@tensorflow/tfjs':
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0(seedrandom@3.0.5)
|
||||
|
@ -678,8 +678,8 @@ importers:
|
|||
specifier: ^4.2.1
|
||||
version: 4.2.1
|
||||
'@syuilo/aiscript':
|
||||
specifier: 0.11.1
|
||||
version: 0.11.1
|
||||
specifier: ^0.13.3
|
||||
version: 0.13.3
|
||||
'@types/escape-regexp':
|
||||
specifier: 0.0.1
|
||||
version: 0.0.1
|
||||
|
@ -2720,14 +2720,13 @@ packages:
|
|||
resolution: {integrity: sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==}
|
||||
requiresBuild: true
|
||||
|
||||
/@syuilo/aiscript@0.11.1:
|
||||
resolution: {integrity: sha512-chwOIA3yLUKvOB0G611hjLArKTeOWNmTm3lHERSaDW1d+dS6do56naX6Lkwy2UpnwWC0qzeNSgg35elk6t2gZg==}
|
||||
/@syuilo/aiscript@0.13.3:
|
||||
resolution: {integrity: sha512-0YFlWA+7YhyRRsp+9Nl72SoSUg5ghskthjCdLvj4qdGyLedeyanKZWJlH2A9d47Nes03UYY8CRDsMHHv64IWcg==}
|
||||
dependencies:
|
||||
autobind-decorator: 2.4.0
|
||||
chalk: 4.0.0
|
||||
seedrandom: 3.0.5
|
||||
stringz: 2.1.0
|
||||
uuid: 7.0.3
|
||||
uuid: 9.0.0
|
||||
|
||||
/@szmarczak/http-timer@4.0.6:
|
||||
resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==}
|
||||
|
@ -5166,13 +5165,6 @@ packages:
|
|||
escape-string-regexp: 1.0.5
|
||||
supports-color: 5.5.0
|
||||
|
||||
/chalk@4.0.0:
|
||||
resolution: {integrity: sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
supports-color: 7.2.0
|
||||
|
||||
/chalk@4.1.2:
|
||||
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -5880,8 +5872,8 @@ packages:
|
|||
requiresBuild: true
|
||||
dev: false
|
||||
|
||||
/core-js@3.30.1:
|
||||
resolution: {integrity: sha512-ZNS5nbiSwDTq4hFosEDqm65izl2CWmLz0hARJMyNQBgkUZMIF51cQiMvIQKA6hvuaeWxQDP3hEedM1JZIgTldQ==}
|
||||
/core-js@3.30.2:
|
||||
resolution: {integrity: sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg==}
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
|
||||
|
@ -7564,7 +7556,7 @@ packages:
|
|||
resolution: {integrity: sha512-+vSd9frUnapVC2RZYfL3FCB2p3g4TBhaUmrsWlSudsGdnxIuUvBB2QM1VZeBtc49QFwrp+wQLrDs3+xxDgI5gQ==}
|
||||
engines: {node: '>= 0.10'}
|
||||
dependencies:
|
||||
graceful-fs: 4.2.10
|
||||
graceful-fs: 4.2.11
|
||||
through2: 2.0.5
|
||||
dev: true
|
||||
|
||||
|
@ -14464,10 +14456,6 @@ packages:
|
|||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/uuid@7.0.3:
|
||||
resolution: {integrity: sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==}
|
||||
hasBin: true
|
||||
|
||||
/uuid@8.0.0:
|
||||
resolution: {integrity: sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==}
|
||||
hasBin: true
|
||||
|
@ -14571,7 +14559,7 @@ packages:
|
|||
dependencies:
|
||||
append-buffer: 1.0.2
|
||||
convert-source-map: 1.9.0
|
||||
graceful-fs: 4.2.10
|
||||
graceful-fs: 4.2.11
|
||||
normalize-path: 2.1.1
|
||||
now-and-later: 2.0.1
|
||||
remove-bom-buffer: 3.0.0
|
||||
|
@ -15309,7 +15297,7 @@ packages:
|
|||
name: plyr
|
||||
version: 3.7.0
|
||||
dependencies:
|
||||
core-js: 3.30.1
|
||||
core-js: 3.30.2
|
||||
custom-event-polyfill: 1.0.7
|
||||
loadjs: 4.2.0
|
||||
rangetouch: 2.0.1
|
||||
|
|
Loading…
Reference in a new issue