nadesiko3 3.7.13 → 3.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/batch/command.txt +473 -473
- package/batch/jsplugin2text.nako3 +2 -0
- package/core/package.json +1 -1
- package/core/src/nako3.mjs +0 -4
- package/core/src/nako3.mts +55 -55
- package/core/src/nako_ast.mjs +0 -1
- package/core/src/nako_ast.mts +1 -1
- package/core/src/nako_colors.mjs +0 -1
- package/core/src/nako_colors.mts +1 -1
- package/core/src/nako_core_version.mjs +2 -2
- package/core/src/nako_core_version.mts +2 -2
- package/core/src/nako_csv.mjs +0 -1
- package/core/src/nako_csv.mts +9 -9
- package/core/src/nako_errors.mts +8 -8
- package/core/src/nako_from_dncl.mts +5 -5
- package/core/src/nako_from_dncl2.mjs +0 -1
- package/core/src/nako_from_dncl2.mts +5 -5
- package/core/src/nako_gen.mjs +13 -15
- package/core/src/nako_gen.mts +224 -220
- package/core/src/nako_global.mts +11 -11
- package/core/src/nako_indent.mts +92 -92
- package/core/src/nako_indent_chars.mts +1 -1
- package/core/src/nako_indent_inline.mjs +11 -11
- package/core/src/nako_indent_inline.mts +20 -20
- package/core/src/nako_lex_rules.mjs +0 -1
- package/core/src/nako_lex_rules.mts +8 -8
- package/core/src/nako_lexer.mjs +0 -1
- package/core/src/nako_lexer.mts +23 -23
- package/core/src/nako_logger.mjs +1 -1
- package/core/src/nako_logger.mts +38 -38
- package/core/src/nako_parser3.mjs +4 -5
- package/core/src/nako_parser3.mts +79 -79
- package/core/src/nako_parser_base.mjs +1 -1
- package/core/src/nako_parser_base.mts +68 -68
- package/core/src/nako_parser_const.mjs +0 -1
- package/core/src/nako_parser_const.mts +1 -1
- package/core/src/nako_prepare.mts +12 -12
- package/core/src/nako_source_mapping.mts +9 -9
- package/core/src/nako_token.mjs +0 -1
- package/core/src/nako_token.mts +2 -2
- package/core/src/nako_tools.mjs +0 -1
- package/core/src/nako_tools.mts +4 -4
- package/core/src/nako_types.mjs +0 -1
- package/core/src/nako_types.mts +3 -3
- package/core/src/plugin_api.mjs +0 -1
- package/core/src/plugin_api.mts +1 -1
- package/core/src/plugin_csv.mjs +0 -1
- package/core/src/plugin_csv.mts +7 -7
- package/core/src/plugin_math.mjs +0 -1
- package/core/src/plugin_math.mts +39 -40
- package/core/src/plugin_promise.mjs +1 -1
- package/core/src/plugin_promise.mts +9 -9
- package/core/src/plugin_system.mjs +1 -10
- package/core/src/plugin_system.mts +319 -321
- package/core/src/plugin_test.mjs +0 -2
- package/core/src/plugin_test.mts +6 -6
- package/core/src/plugin_toml.mjs +1 -1
- package/core/src/plugin_toml.mts +4 -4
- package/core/test/flow_test.mjs +22 -0
- package/package.json +31 -34
- package/release/_hash.txt +24 -24
- package/release/_script-tags.txt +16 -16
- package/release/command_cnako3.json +1 -1
- package/release/edit_main.js +33 -21
- package/release/edit_main.js.map +4 -4
- package/release/editor.js +33 -21
- package/release/plugin_keigo.js.map +2 -2
- package/release/plugin_turtle.js.map +2 -2
- package/release/plugin_weykturtle3d.js.map +2 -2
- package/release/version.js +29 -17
- package/release/version_main.js +29 -17
- package/release/version_main.js.map +4 -4
- package/release/wnako3.js +51 -44
- package/release/wnako3.js.map +3 -3
- package/release/wnako3webworker.js +45 -38
- package/release/wnako3webworker.js.map +2 -2
- package/src/cnako3.mts +1 -1
- package/src/cnako3mod.mjs +4 -7
- package/src/cnako3mod.mts +24 -24
- package/src/commander_ja.mts +8 -8
- package/src/deno_wrapper.mjs +0 -1
- package/src/deno_wrapper.mts +5 -5
- package/src/nako_version.mjs +2 -2
- package/src/nako_version.mts +2 -2
- package/src/plugin_browser.mjs +21 -29
- package/src/plugin_browser.mts +30 -35
- package/src/plugin_browser_ajax.mts +27 -27
- package/src/plugin_browser_audio.mjs +0 -1
- package/src/plugin_browser_audio.mts +11 -11
- package/src/plugin_browser_camera.mts +8 -8
- package/src/plugin_browser_canvas.mjs +0 -2
- package/src/plugin_browser_canvas.mts +34 -34
- package/src/plugin_browser_chart.mjs +0 -1
- package/src/plugin_browser_chart.mts +13 -13
- package/src/plugin_browser_color.mts +2 -2
- package/src/plugin_browser_crypto.mts +5 -5
- package/src/plugin_browser_dialog.mts +4 -4
- package/src/plugin_browser_dom_basic.mts +42 -42
- package/src/plugin_browser_dom_event.mjs +0 -1
- package/src/plugin_browser_dom_event.mts +27 -28
- package/src/plugin_browser_dom_parts.mjs +0 -2
- package/src/plugin_browser_dom_parts.mts +31 -31
- package/src/plugin_browser_geolocation.mts +3 -3
- package/src/plugin_browser_hotkey.mts +3 -3
- package/src/plugin_browser_html.mts +4 -4
- package/src/plugin_browser_in_worker.mts +1 -1
- package/src/plugin_browser_location.mts +2 -2
- package/src/plugin_browser_speech.mts +7 -7
- package/src/plugin_browser_storage.mts +11 -11
- package/src/plugin_browser_system.mts +2 -2
- package/src/plugin_browser_websocket.mts +6 -6
- package/src/plugin_httpserver.mts +17 -17
- package/src/plugin_keigo.mts +5 -5
- package/src/plugin_node.mjs +7 -48
- package/src/plugin_node.mts +114 -145
- package/src/plugin_turtle.mts +143 -143
- package/src/plugin_weykturtle3d.mjs +0 -3
- package/src/plugin_weykturtle3d.mts +135 -135
- package/src/plugin_weykturtle3d_three.mjs +0 -1
- package/src/plugin_weykturtle3d_three.mts +1 -1
- package/src/plugin_weykturtle3d_threeutil.mts +3 -3
- package/src/wnako3.mjs +0 -1
- package/src/wnako3.mts +1 -1
- package/src/wnako3_editor.mjs +0 -2
- package/src/wnako3_editor.mts +132 -132
- package/src/wnako3mod.mjs +0 -5
- package/src/wnako3mod.mts +19 -19
package/src/wnako3mod.mjs
CHANGED
|
@@ -79,7 +79,6 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
79
79
|
}
|
|
80
80
|
/** なでしこ3の『取り込む』命令のための読み込みツール */
|
|
81
81
|
getLoaderTool() {
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
83
82
|
const tool = { readJs: this.readJs, readNako3: this.readNako3, resolvePath: this.resolvePath };
|
|
84
83
|
return tool;
|
|
85
84
|
}
|
|
@@ -87,9 +86,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
87
86
|
readJs(filePath, token) {
|
|
88
87
|
if (this.localFiles && this.localFiles[filePath]) {
|
|
89
88
|
return {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
91
89
|
task: (async () => () => {
|
|
92
|
-
// eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval, @typescript-eslint/no-unsafe-call
|
|
93
90
|
Function(this.localFiles[filePath])();
|
|
94
91
|
return {};
|
|
95
92
|
})()
|
|
@@ -133,12 +130,10 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
133
130
|
const globalNako3 = globalNavigator.nako3;
|
|
134
131
|
globalNavigator.nako3 = gSelf;
|
|
135
132
|
try {
|
|
136
|
-
// eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
|
|
137
133
|
const f = Function(jstext);
|
|
138
134
|
f.apply(gSelf.__globalObj);
|
|
139
135
|
}
|
|
140
136
|
catch (err) {
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
142
137
|
throw new NakoImportError(`プラグイン ${filePath} の取り込みに失敗: ${err instanceof Error ? err.message : err + ''}`, token.file, token.line);
|
|
143
138
|
}
|
|
144
139
|
finally {
|
package/src/wnako3mod.mts
CHANGED
|
@@ -15,7 +15,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
15
15
|
version: string
|
|
16
16
|
wnakoVersion: NakoVersion
|
|
17
17
|
localFiles: Record<string, string>
|
|
18
|
-
constructor
|
|
18
|
+
constructor() {
|
|
19
19
|
super({ useBasicPlugin: true })
|
|
20
20
|
this.version = nakoVersion.version
|
|
21
21
|
this.wnakoVersion = nakoVersion
|
|
@@ -34,7 +34,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
34
34
|
/**
|
|
35
35
|
* ブラウザでtype="なでしこ"というスクリプトを得て実行する
|
|
36
36
|
*/
|
|
37
|
-
async runNakoScript
|
|
37
|
+
async runNakoScript() {
|
|
38
38
|
// スクリプトタグの中身を得る
|
|
39
39
|
let nakoScriptCount = 0
|
|
40
40
|
const scripts = document.querySelectorAll('script')
|
|
@@ -58,7 +58,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/** 取り込む文を実行する */
|
|
61
|
-
async loadDependencies
|
|
61
|
+
async loadDependencies(code: string, filename: string, preCode = '', localFiles: any = {}): Promise<unknown> {
|
|
62
62
|
this.localFiles = localFiles || {}
|
|
63
63
|
return this._loadDependencies(code, filename, preCode, this.getLoaderTool())
|
|
64
64
|
}
|
|
@@ -67,7 +67,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
67
67
|
* type=なでしこ のスクリプトを自動実行するべきかどうかを返す
|
|
68
68
|
* @returns type=なでしこ のスクリプトを自動実行するべきかどうか
|
|
69
69
|
*/
|
|
70
|
-
checkScriptTagParam
|
|
70
|
+
checkScriptTagParam(): boolean {
|
|
71
71
|
const scripts = document.querySelectorAll('script')
|
|
72
72
|
for (let i = 0; i < scripts.length; i++) {
|
|
73
73
|
const script = scripts[i]
|
|
@@ -85,31 +85,31 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
85
85
|
* @param {string | Element} idOrElement HTML要素
|
|
86
86
|
* @see {setupEditor}
|
|
87
87
|
*/
|
|
88
|
-
setupEditor
|
|
88
|
+
setupEditor(idOrElement: any) {
|
|
89
89
|
return setupEditor(idOrElement, this, (window as any).ace)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/** なでしこ3の『取り込む』命令のための読み込みツール */
|
|
93
|
-
getLoaderTool
|
|
94
|
-
|
|
93
|
+
getLoaderTool(): LoaderTool {
|
|
94
|
+
|
|
95
95
|
const tool = { readJs: this.readJs, readNako3: this.readNako3, resolvePath: this.resolvePath }
|
|
96
96
|
return tool
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/** JSプラグインの読み込み */
|
|
100
|
-
readJs
|
|
100
|
+
readJs(filePath: string, token: Token): LoaderToolTask<any> {
|
|
101
101
|
if (this.localFiles && this.localFiles[filePath]) {
|
|
102
102
|
return {
|
|
103
|
-
|
|
104
|
-
task: (async
|
|
105
|
-
|
|
103
|
+
|
|
104
|
+
task: (async() => () => {
|
|
105
|
+
|
|
106
106
|
Function(this.localFiles[filePath])()
|
|
107
107
|
return {}
|
|
108
108
|
})()
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
return {
|
|
112
|
-
task: (async
|
|
112
|
+
task: (async() => {
|
|
113
113
|
// もし動的インポートに対応していれば動的インポートを試す
|
|
114
114
|
const basename = ('/' + filePath).split('/').pop() || '?'
|
|
115
115
|
/*
|
|
@@ -146,11 +146,11 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
146
146
|
const globalNako3 = globalNavigator.nako3
|
|
147
147
|
globalNavigator.nako3 = gSelf
|
|
148
148
|
try {
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
const f = Function(jstext)
|
|
151
151
|
f.apply(gSelf.__globalObj)
|
|
152
152
|
} catch (err) {
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
throw new NakoImportError(`プラグイン ${filePath} の取り込みに失敗: ${err instanceof Error ? err.message : err + ''}`, token.file, token.line)
|
|
155
155
|
} finally {
|
|
156
156
|
globalNavigator.nako3 = globalNako3
|
|
@@ -162,7 +162,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/** NAKO3プラグインの読み込み */
|
|
165
|
-
readNako3
|
|
165
|
+
readNako3(filePath: string, token: Token): LoaderToolTask<string> {
|
|
166
166
|
if (this.localFiles && this.localFiles[filePath]) { // ローカルファイルを使う場合
|
|
167
167
|
return {
|
|
168
168
|
task: (() => {
|
|
@@ -174,7 +174,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
return {
|
|
177
|
-
task: (async
|
|
177
|
+
task: (async() => {
|
|
178
178
|
const res = await fetch(filePath)
|
|
179
179
|
if (!res.ok) {
|
|
180
180
|
throw new NakoImportError(`ファイル ${filePath} のダウンロードに失敗しました: ${res.status} ${res.statusText}`, token.file, token.line)
|
|
@@ -185,7 +185,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/** 読み込みでパスを解決する */
|
|
188
|
-
resolvePath
|
|
188
|
+
resolvePath(name: string, token: Token, fromFile: string) {
|
|
189
189
|
let pathname = name
|
|
190
190
|
// http から始まっていれば解決は不要
|
|
191
191
|
if (pathname.match(/^https?:\/\//)) { // フルパスなら解決不要
|
|
@@ -230,7 +230,7 @@ export class WebNakoCompiler extends NakoCompiler {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
function dirname
|
|
233
|
+
function dirname(s: string) {
|
|
234
234
|
const a = s.split('/')
|
|
235
235
|
if (a && a.length > 1) {
|
|
236
236
|
return a.slice(0, a.length - 1).join('/')
|
|
@@ -238,7 +238,7 @@ function dirname (s: string) {
|
|
|
238
238
|
return ''
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
function resolveURL
|
|
241
|
+
function resolveURL(base: string, s: string) {
|
|
242
242
|
const baseA = base.split('/')
|
|
243
243
|
const sA = s.split('/')
|
|
244
244
|
for (const p of sA) {
|