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.
Files changed (127) hide show
  1. package/batch/command.txt +473 -473
  2. package/batch/jsplugin2text.nako3 +2 -0
  3. package/core/package.json +1 -1
  4. package/core/src/nako3.mjs +0 -4
  5. package/core/src/nako3.mts +55 -55
  6. package/core/src/nako_ast.mjs +0 -1
  7. package/core/src/nako_ast.mts +1 -1
  8. package/core/src/nako_colors.mjs +0 -1
  9. package/core/src/nako_colors.mts +1 -1
  10. package/core/src/nako_core_version.mjs +2 -2
  11. package/core/src/nako_core_version.mts +2 -2
  12. package/core/src/nako_csv.mjs +0 -1
  13. package/core/src/nako_csv.mts +9 -9
  14. package/core/src/nako_errors.mts +8 -8
  15. package/core/src/nako_from_dncl.mts +5 -5
  16. package/core/src/nako_from_dncl2.mjs +0 -1
  17. package/core/src/nako_from_dncl2.mts +5 -5
  18. package/core/src/nako_gen.mjs +13 -15
  19. package/core/src/nako_gen.mts +224 -220
  20. package/core/src/nako_global.mts +11 -11
  21. package/core/src/nako_indent.mts +92 -92
  22. package/core/src/nako_indent_chars.mts +1 -1
  23. package/core/src/nako_indent_inline.mjs +11 -11
  24. package/core/src/nako_indent_inline.mts +20 -20
  25. package/core/src/nako_lex_rules.mjs +0 -1
  26. package/core/src/nako_lex_rules.mts +8 -8
  27. package/core/src/nako_lexer.mjs +0 -1
  28. package/core/src/nako_lexer.mts +23 -23
  29. package/core/src/nako_logger.mjs +1 -1
  30. package/core/src/nako_logger.mts +38 -38
  31. package/core/src/nako_parser3.mjs +4 -5
  32. package/core/src/nako_parser3.mts +79 -79
  33. package/core/src/nako_parser_base.mjs +1 -1
  34. package/core/src/nako_parser_base.mts +68 -68
  35. package/core/src/nako_parser_const.mjs +0 -1
  36. package/core/src/nako_parser_const.mts +1 -1
  37. package/core/src/nako_prepare.mts +12 -12
  38. package/core/src/nako_source_mapping.mts +9 -9
  39. package/core/src/nako_token.mjs +0 -1
  40. package/core/src/nako_token.mts +2 -2
  41. package/core/src/nako_tools.mjs +0 -1
  42. package/core/src/nako_tools.mts +4 -4
  43. package/core/src/nako_types.mjs +0 -1
  44. package/core/src/nako_types.mts +3 -3
  45. package/core/src/plugin_api.mjs +0 -1
  46. package/core/src/plugin_api.mts +1 -1
  47. package/core/src/plugin_csv.mjs +0 -1
  48. package/core/src/plugin_csv.mts +7 -7
  49. package/core/src/plugin_math.mjs +0 -1
  50. package/core/src/plugin_math.mts +39 -40
  51. package/core/src/plugin_promise.mjs +1 -1
  52. package/core/src/plugin_promise.mts +9 -9
  53. package/core/src/plugin_system.mjs +1 -10
  54. package/core/src/plugin_system.mts +319 -321
  55. package/core/src/plugin_test.mjs +0 -2
  56. package/core/src/plugin_test.mts +6 -6
  57. package/core/src/plugin_toml.mjs +1 -1
  58. package/core/src/plugin_toml.mts +4 -4
  59. package/core/test/flow_test.mjs +22 -0
  60. package/package.json +31 -34
  61. package/release/_hash.txt +24 -24
  62. package/release/_script-tags.txt +16 -16
  63. package/release/command_cnako3.json +1 -1
  64. package/release/edit_main.js +33 -21
  65. package/release/edit_main.js.map +4 -4
  66. package/release/editor.js +33 -21
  67. package/release/plugin_keigo.js.map +2 -2
  68. package/release/plugin_turtle.js.map +2 -2
  69. package/release/plugin_weykturtle3d.js.map +2 -2
  70. package/release/version.js +29 -17
  71. package/release/version_main.js +29 -17
  72. package/release/version_main.js.map +4 -4
  73. package/release/wnako3.js +51 -44
  74. package/release/wnako3.js.map +3 -3
  75. package/release/wnako3webworker.js +45 -38
  76. package/release/wnako3webworker.js.map +2 -2
  77. package/src/cnako3.mts +1 -1
  78. package/src/cnako3mod.mjs +4 -7
  79. package/src/cnako3mod.mts +24 -24
  80. package/src/commander_ja.mts +8 -8
  81. package/src/deno_wrapper.mjs +0 -1
  82. package/src/deno_wrapper.mts +5 -5
  83. package/src/nako_version.mjs +2 -2
  84. package/src/nako_version.mts +2 -2
  85. package/src/plugin_browser.mjs +21 -29
  86. package/src/plugin_browser.mts +30 -35
  87. package/src/plugin_browser_ajax.mts +27 -27
  88. package/src/plugin_browser_audio.mjs +0 -1
  89. package/src/plugin_browser_audio.mts +11 -11
  90. package/src/plugin_browser_camera.mts +8 -8
  91. package/src/plugin_browser_canvas.mjs +0 -2
  92. package/src/plugin_browser_canvas.mts +34 -34
  93. package/src/plugin_browser_chart.mjs +0 -1
  94. package/src/plugin_browser_chart.mts +13 -13
  95. package/src/plugin_browser_color.mts +2 -2
  96. package/src/plugin_browser_crypto.mts +5 -5
  97. package/src/plugin_browser_dialog.mts +4 -4
  98. package/src/plugin_browser_dom_basic.mts +42 -42
  99. package/src/plugin_browser_dom_event.mjs +0 -1
  100. package/src/plugin_browser_dom_event.mts +27 -28
  101. package/src/plugin_browser_dom_parts.mjs +0 -2
  102. package/src/plugin_browser_dom_parts.mts +31 -31
  103. package/src/plugin_browser_geolocation.mts +3 -3
  104. package/src/plugin_browser_hotkey.mts +3 -3
  105. package/src/plugin_browser_html.mts +4 -4
  106. package/src/plugin_browser_in_worker.mts +1 -1
  107. package/src/plugin_browser_location.mts +2 -2
  108. package/src/plugin_browser_speech.mts +7 -7
  109. package/src/plugin_browser_storage.mts +11 -11
  110. package/src/plugin_browser_system.mts +2 -2
  111. package/src/plugin_browser_websocket.mts +6 -6
  112. package/src/plugin_httpserver.mts +17 -17
  113. package/src/plugin_keigo.mts +5 -5
  114. package/src/plugin_node.mjs +7 -48
  115. package/src/plugin_node.mts +114 -145
  116. package/src/plugin_turtle.mts +143 -143
  117. package/src/plugin_weykturtle3d.mjs +0 -3
  118. package/src/plugin_weykturtle3d.mts +135 -135
  119. package/src/plugin_weykturtle3d_three.mjs +0 -1
  120. package/src/plugin_weykturtle3d_three.mts +1 -1
  121. package/src/plugin_weykturtle3d_threeutil.mts +3 -3
  122. package/src/wnako3.mjs +0 -1
  123. package/src/wnako3.mts +1 -1
  124. package/src/wnako3_editor.mjs +0 -2
  125. package/src/wnako3_editor.mts +132 -132
  126. package/src/wnako3mod.mjs +0 -5
  127. 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 (code: string, filename: string, preCode = '', localFiles: any = {}): Promise<unknown> {
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 (): boolean {
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 (idOrElement: any) {
88
+ setupEditor(idOrElement: any) {
89
89
  return setupEditor(idOrElement, this, (window as any).ace)
90
90
  }
91
91
 
92
92
  /** なでしこ3の『取り込む』命令のための読み込みツール */
93
- getLoaderTool (): LoaderTool {
94
- // eslint-disable-next-line @typescript-eslint/unbound-method
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 (filePath: string, token: Token): LoaderToolTask<any> {
100
+ readJs(filePath: string, token: Token): LoaderToolTask<any> {
101
101
  if (this.localFiles && this.localFiles[filePath]) {
102
102
  return {
103
- // eslint-disable-next-line @typescript-eslint/require-await
104
- task: (async () => () => {
105
- // eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval, @typescript-eslint/no-unsafe-call
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
- // eslint-disable-next-line no-new-func, @typescript-eslint/no-implied-eval
149
+
150
150
  const f = Function(jstext)
151
151
  f.apply(gSelf.__globalObj)
152
152
  } catch (err) {
153
- // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
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 (filePath: string, token: Token): LoaderToolTask<string> {
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 (name: string, token: Token, fromFile: string) {
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 (s: string) {
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 (base: string, s: string) {
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) {