nadesiko3 3.4.22 → 3.4.23

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 (92) hide show
  1. package/batch/command.txt +5 -4
  2. package/batch/command_nakopad.txt +3 -2
  3. package/core/.editorconfig +6 -0
  4. package/core/.eslintrc.cjs +41 -0
  5. package/core/.github/dependabot.yml +7 -0
  6. package/core/.github/workflows/nodejs.yml +40 -0
  7. package/core/.github/workflows/textlint.yml +199 -0
  8. package/core/bun.lockb +0 -0
  9. package/core/core.code-workspace +8 -0
  10. package/core/deno/plugin_snako_deno.ts +109 -0
  11. package/core/deno/snako.ts +116 -0
  12. package/core/deno_build_ver.sh +4 -0
  13. package/core/deno_hello.sh +7 -0
  14. package/core/doc/README.md +68 -0
  15. package/core/index.mts +27 -0
  16. package/core/package-lock.json +3537 -0
  17. package/core/package.json +1 -1
  18. package/core/src/nako3.mjs +29 -1
  19. package/core/src/nako3.mts +27 -1
  20. package/core/src/nako_core_version.mjs +2 -2
  21. package/core/src/nako_core_version.mts +2 -2
  22. package/core/src/nako_lex_rules.mts +1 -1
  23. package/core/src/nako_parser3.mjs +33 -34
  24. package/core/src/nako_parser3.mts +45 -53
  25. package/core/src/plugin_system.mts +1 -1
  26. package/core/test/andor_test.mjs +26 -0
  27. package/core/test/array_test.mjs +65 -0
  28. package/core/test/basic_test.mjs +358 -0
  29. package/core/test/calc_test.mjs +240 -0
  30. package/core/test/core_module_test.mjs +23 -0
  31. package/core/test/debug_test.mjs +17 -0
  32. package/core/test/dncl2_test.mjs +246 -0
  33. package/core/test/dncl_test.mjs +179 -0
  34. package/core/test/error_message_test.mjs +210 -0
  35. package/core/test/error_test.mjs +17 -0
  36. package/core/test/flow_test.mjs +433 -0
  37. package/core/test/func_call.mjs +163 -0
  38. package/core/test/func_test.mjs +150 -0
  39. package/core/test/indent_test.mjs +273 -0
  40. package/core/test/inline_indent_test.mjs +178 -0
  41. package/core/test/lex_test.mjs +177 -0
  42. package/core/test/literal_test.mjs +87 -0
  43. package/core/test/nako_lexer_test.mjs +36 -0
  44. package/core/test/nako_logger_test.mjs +78 -0
  45. package/core/test/or_test.mjs +30 -0
  46. package/core/test/plugin_csv_test.mjs +38 -0
  47. package/core/test/plugin_math_test.mjs +34 -0
  48. package/core/test/plugin_promise_test.mjs +18 -0
  49. package/core/test/plugin_system_test.mjs +651 -0
  50. package/core/test/prepare_test.mjs +96 -0
  51. package/core/test/re_test.mjs +22 -0
  52. package/core/test/side_effects_test.mjs +98 -0
  53. package/core/test/variable_scope_test.mjs +149 -0
  54. package/core/tsconfig.json +102 -0
  55. package/package.json +1 -1
  56. package/release/_hash.txt +24 -24
  57. package/release/_script-tags.txt +14 -14
  58. package/release/command.json +1 -1
  59. package/release/command.json.js +1 -1
  60. package/release/command_cnako3.json +1 -1
  61. package/release/command_list.json +1 -1
  62. package/release/editor.js +1 -1
  63. package/release/editor.js.map +1 -1
  64. package/release/nako_gen_async.js +1 -1
  65. package/release/nako_gen_async.js.map +1 -1
  66. package/release/stats.json +1 -1
  67. package/release/version.js +1 -1
  68. package/release/version.js.map +1 -1
  69. package/release/wnako3.js +1 -1
  70. package/release/wnako3.js.map +1 -1
  71. package/release/wnako3webworker.js +1 -1
  72. package/release/wnako3webworker.js.map +1 -1
  73. package/src/nako_version.mjs +2 -2
  74. package/src/nako_version.mts +2 -2
  75. package/src/plugin_browser_dialog.mjs +3 -2
  76. package/src/plugin_browser_dialog.mts +4 -3
  77. package/test/common/plugin_browser_ut_dialog_test.mjs +2 -2
  78. package/batch/.DS_Store +0 -0
  79. package/core/batch/.DS_Store +0 -0
  80. package/core/command/.DS_Store +0 -0
  81. package/demo/extlib/.DS_Store +0 -0
  82. package/release/.DS_Store +0 -0
  83. package/test/.DS_Store +0 -0
  84. package/test/browser/.DS_Store +0 -0
  85. package/test/bundled/.DS_Store +0 -0
  86. package/test/bundled/test_base/.DS_Store +0 -0
  87. package/test/common/.DS_Store +0 -0
  88. package/test/node/.DS_Store +0 -0
  89. package/test/selenium/.DS_Store +0 -0
  90. package/tools/.DS_Store +0 -0
  91. package/tools/nako3edit/.DS_Store +0 -0
  92. package/tools/nako3edit/html/.DS_Store +0 -0
package/batch/command.txt CHANGED
@@ -190,7 +190,7 @@
190
190
  | 関数 | 配列挿入 | AのIにSを/Iへ | 配列AのI番目(0起点)に要素Sを追加して返す(v1非互換) | はいれつそうにゅう | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1569
191
191
  | 関数 | 配列一括挿入 | AのIにBを/Iへ | 配列AのI番目(0起点)に配列bを追加して返す(v1非互換) | はいれついっかつそうにゅう | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1579
192
192
  | 関数 | 配列ソート | Aの/Aを | 配列Aをソートして返す(A自体を変更) | はいれつそーと | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1592
193
- | 関数 | 配列数値変換 | Aの/Aを | 配列Aを変換変換して返す(A自体を変更) | はいれつすうちへんかん | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1602
193
+ | 関数 | 配列数値変換 | Aの/Aを | 配列Aの各要素を数値に変換して返す(変数A自体を変更) | はいれつすうちへんかん | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1602
194
194
  | 関数 | 配列数値ソート | Aの/Aを | 配列Aをソートして返す(A自体を変更) | はいれつすうちそーと | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1617
195
195
  | 関数 | 配列カスタムソート | FでAの/Aを | 関数Fで配列Aをソートして返す(引数A自体を変更) | はいれつかすたむそーと | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1632
196
196
  | 関数 | 配列逆順 | Aの/Aを | 配列Aを逆にして返す。Aを書き換える(A自体を変更)。 | はいれつぎゃくじゅん | https://github.com/kujirahand/nadesiko3core/blob/main/src/plugin_system.mts#L1647
@@ -399,9 +399,10 @@
399
399
  | 関数 | OS取得 | | OSプラットフォームを返す(darwin/windows/ubuntu/linux/android/iphone/ipad/unknown) | OSしゅとく | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_system.mts#L24
400
400
  ●ダイアログ
401
401
  | 関数 | 言 | Sと/Sを | メッセージダイアログにSを表示 | いう | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L8
402
- | 関数 | | Sと/Sを | メッセージSと入力ボックスを出して尋ねる | たずねる | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L17
403
- | 関数 | 文字尋 | Sと/Sを | メッセージSと入力ボックスを出して尋ねる。返り値は常に入力されたままの文字列となる | もじたずねる | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L37
404
- | 関数 | 二択 | Sで/Sの/Sと/Sを | メッセージSと[OK]と[キャンセル]のダイアログを出して尋ねる | にたく | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L49
402
+ | 変数 | ダイアログキャンセル値 | | '' | だいあろぐきゃんせるち | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L13
403
+ | 関数 | | Sと/Sを | メッセージSと入力ボックスを出して尋ねる | たずねる | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L18
404
+ | 関数 | 文字尋 | Sと/Sを | メッセージSと入力ボックスを出して尋ねる。返り値は常に入力されたままの文字列となる | もじたずねる | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L38
405
+ | 関数 | 二択 | Sで/Sの/Sと/Sを | メッセージSと[OK][キャンセル]のダイアログを出して尋ねる。戻り値はtrueかfalseのどちらかになる。 | にたく | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_dialog.mts#L50
405
406
  ●ブラウザ操作
406
407
  | 関数 | ブラウザ移動 | URLに/URLへ | 任意のURLにブラウザ移動(ただし移動後スクリプトの実行は停止する) | ぶらうざいどう | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_location.mts#L8
407
408
  | 関数 | ブラウザ戻 | | 任意のURLにブラウザ移動(ただし移動後スクリプトの実行は停止する) | ぶらうざもどる | https://github.com/kujirahand/nadesiko3/blob/master/src/plugin_browser_location.mts#L16
@@ -190,7 +190,7 @@
190
190
  |�z��}��,"A��I��S��|I��","�z��A��I�Ԗ�(0�N�_)�ɗv�fS��lj����ĕԂ�(v1��݊�)",0,,����,�͂���‚����ɂイ
191
191
  |�z��ꊇ�}��,"A��I��B��|I��","�z��A��I�Ԗ�(0�N�_)�ɔz��b��lj����ĕԂ�(v1��݊�)",0,,����,�͂���‚������‚����ɂイ
192
192
  |�z��\�[�g,"A��|A��","�z��A���\�[�g���ĕԂ�(A���̂�ύX)",0,,����,�͂���‚��[��
193
- |�z�񐔒l�ϊ�,"A��|A��","�z��A��ϊ��ϊ����ĕԂ�(A���̂�ύX)",0,,����,�͂���‚������ւ񂩂�
193
+ |�z�񐔒l�ϊ�,"A��|A��","�z��A�̊e�v�f�𐔒l�ɕϊ����ĕԂ�(�ϐ�A���̂�ύX)",0,,����,�͂���‚������ւ񂩂�
194
194
  |�z�񐔒l�\�[�g,"A��|A��","�z��A���\�[�g���ĕԂ�(A���̂�ύX)",0,,����,�͂���‚��������[��
195
195
  |�z��J�X�^���\�[�g,"F��A��|A��","�֐�F�Ŕz��A���\�[�g���ĕԂ�(����A���̂�ύX)",0,,����,�͂���‚������ނ��[��
196
196
  |�z��t��,"A��|A��","�z��A���t�ɂ��ĕԂ��BA������������(A���̂�ύX)�B",0,,����,�͂���‚��Ⴍ�����
@@ -391,9 +391,10 @@
391
391
  |OS�擾,"","OS�v���b�g�t�H�[����Ԃ�(darwin/windows/ubuntu/linux/android/iphone/ipad/unknown)",0,,����,OS����Ƃ�
392
392
  - �_�C�A���O
393
393
  |��,"S��|S��","���b�Z�[�W�_�C�A���O��S��\��",0,,����,����
394
+ |�_�C�A���O�L�����Z���l,"","''",0,,�ϐ�,�������낮����񂹂邿
394
395
  |�q,"S��|S��","���b�Z�[�WS�Ɠ��̓{�b�N�X���o���Đq�˂�",0,,����,�����˂�
395
396
  |�����q,"S��|S��","���b�Z�[�WS�Ɠ��̓{�b�N�X���o���Đq�˂�B�Ԃ�l�͏�ɓ��͂��ꂽ�܂܂̕�����ƂȂ�",0,,����,���������˂�
396
- |���,"S��|S��|S��|S��","���b�Z�[�WS��[OK]��[�L�����Z��]�̃_�C�A���O���o���Đq�˂�",0,,����,�ɂ���
397
+ |���,"S��|S��|S��|S��","���b�Z�[�WS��[OK][�L�����Z��]�̃_�C�A���O���o���Đq�˂�B�߂�l��true��false�̂ǂ��炩�ɂȂ�B",0,,����,�ɂ���
397
398
  - �u���E�U����
398
399
  |�u���E�U�ړ�,"URL��|URL��","�C�ӂ�URL�Ƀu���E�U�ړ�(�������ړ���X�N���v�g�̎��s�͒�~����)",0,,����,�Ԃ炤�����ǂ�
399
400
  |�u���E�U��,"","�C�ӂ�URL�Ƀu���E�U�ړ�(�������ړ���X�N���v�g�̎��s�͒�~����)",0,,����,�Ԃ炤�����ǂ�
@@ -0,0 +1,6 @@
1
+ [*]
2
+ charset = utf-8
3
+ end_of_line = lf
4
+ insert_final_newline = true
5
+ indent_style = space
6
+ indent_size = 2
@@ -0,0 +1,41 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "commonjs": false,
5
+ "es2021": true
6
+ },
7
+ "extends": [
8
+ "standard",
9
+ "standard-with-typescript",
10
+ "eslint:recommended",
11
+ "plugin:@typescript-eslint/recommended"
12
+ ],
13
+ "parserOptions": {
14
+ "ecmaVersion": "latest",
15
+ "sourceType": "module",
16
+ "project": "./tsconfig.json",
17
+ // "extraFileExtensions": [".mts", ".mjs"]
18
+ },
19
+ "rules": {
20
+ "quote-props": "off", // 重要
21
+ "@typescript-eslint/no-explicit-any": "off", // any型を認めないをオフ
22
+ "@typescript-eslint/explicit-module-boundary-types": "off", // 型の指定に関する警告をオフ
23
+ "@typescript-eslint/ban-ts-comment": "off", // @ts-nocheck を許さないをオフ
24
+ //"@typescript-eslint/no-unused-vars": 0,
25
+ //"@typescript-eslint/no-empty-function": 0,
26
+ // "no-unused-vars":0,
27
+ // "no-undef": 0
28
+ //"react/prop-types": "off"
29
+ },
30
+ "plugins": [
31
+ "@typescript-eslint"
32
+ ],
33
+ "ignorePatterns": [
34
+ "node_modules/",
35
+ "src/*.mjs",
36
+ "**/*.js",
37
+ "command/*.mts",
38
+ "deno/*.ts"
39
+ ],
40
+ "root": true
41
+ }
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
@@ -0,0 +1,40 @@
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ # (memo)
5
+ # GitHubで頻繁にブラウザテストが失敗するので
6
+ # コミット時のテストを簡易化しています。
7
+ # ただし、リリース前には必ず全テスト実行するように
8
+ # publish用のスクリプトを追加してミスを防ぎます。
9
+ # [詳細] https://github.com/kujirahand/nadesiko3/issues/1037
10
+
11
+ name: Node.js CI
12
+
13
+ on:
14
+ push:
15
+ branches: [ main ]
16
+ pull_request:
17
+ branches: [ main ]
18
+
19
+ jobs:
20
+ build:
21
+
22
+ runs-on: ubuntu-latest
23
+
24
+ strategy:
25
+ matrix:
26
+ node-version: [18.x, 16.x, 14.x]
27
+
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@v3
31
+ - name: Use Node.js ${{ matrix.node-version }}
32
+ uses: actions/setup-node@v3
33
+ with:
34
+ node-version: ${{ matrix.node-version }}
35
+ # 各種ライブラリをインストール
36
+ - run: npm install
37
+ # 各種ビルドしてテストする
38
+ - run: npm run build
39
+ - run: npm run test
40
+
@@ -0,0 +1,199 @@
1
+ name: textlint CI
2
+
3
+ # pull_requestで何かあった時に起動する
4
+ on:
5
+ pull_request:
6
+
7
+ jobs:
8
+ # textlintをかけ、結果をPRにコメントとして表示する。
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ node-version: [ 16.x ]
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ with:
18
+ fetch-depth: 0
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v1.4.4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ - name: Install dependencies
24
+ run: |
25
+ yarn install -D
26
+ # lintする
27
+ - name: Lint files
28
+ id: lint
29
+ run: |
30
+ result="$(yarn run textlint 2>&1)" || true
31
+ echo "$result"
32
+ result="${result//'%'/'%25'}"
33
+ result="${result//$'\n'/'%0A'}"
34
+ result="${result//$'\r'/'%0D'}"
35
+ echo "::set-output name=result::$result"
36
+ true
37
+ continue-on-error: true
38
+ # lint結果をコメントに残す
39
+ - name: Lint Comment
40
+ if: github.event.pull_request.head.repo.full_name == github.repository && steps.lint.outputs.result != ''
41
+ uses: actions/github-script@v3
42
+ with:
43
+ github-token: ${{secrets.GITHUB_TOKEN}}
44
+ script: |
45
+ const issues_listComments_params = {
46
+ issue_number: context.issue.number,
47
+ owner: context.repo.owner,
48
+ repo: context.repo.repo
49
+ }
50
+ console.log("call issues.listComments:", issues_listComments_params)
51
+ const issue_comments = (await github.paginate(github.issues.listComments, issues_listComments_params)).filter(
52
+ issue_comment => issue_comment.user.id==41898282 && issue_comment.body.startsWith('日本語の')
53
+ )
54
+
55
+ for (const issue_comment of issue_comments) {
56
+ const issues_deleteComment_params = {
57
+ comment_id: issue_comment.id,
58
+ owner: context.repo.owner,
59
+ repo: context.repo.repo
60
+ }
61
+ console.log("call issues.deleteComment:", issues_deleteComment_params)
62
+ await github.issues.deleteComment(issues_deleteComment_params)
63
+ }
64
+
65
+ const result = `${{steps.lint.outputs.result}}`
66
+ const issues_createComment_params = {
67
+ issue_number: context.issue.number,
68
+ owner: context.repo.owner,
69
+ repo: context.repo.repo,
70
+ body: "日本語のLint結果\n```\n"+result+"\n```"
71
+ }
72
+ console.log("call issues.createComment:", issues_createComment_params)
73
+ await github.issues.createComment(issues_createComment_params)
74
+ - name: Exit
75
+ if: github.event.pull_request.head.repo.full_name != github.repository && steps.lint.outcome == 'failure'
76
+ run: exit 1
77
+
78
+ # PRが来たらtextlintをかけてみて、差分があればPRを作って、エラーで落ちるjob
79
+ format:
80
+ runs-on: ubuntu-latest
81
+ if: github.event.pull_request.head.repo.full_name == github.repository
82
+ strategy:
83
+ matrix:
84
+ node-version: [ 16.x ]
85
+
86
+ steps:
87
+ - uses: actions/checkout@v2
88
+ with:
89
+ fetch-depth: 0
90
+ - name: Use Node.js ${{ matrix.node-version }}
91
+ uses: actions/setup-node@v1.4.4
92
+ with:
93
+ node-version: ${{ matrix.node-version }}
94
+ - name: Install dependencies
95
+ run: |
96
+ yarn install -D
97
+ # textlintでformatする
98
+ - name: Format files
99
+ id: format
100
+ run: |
101
+ yarn run textlint:fix
102
+ continue-on-error: true
103
+ # 差分があったときは差分を出力する
104
+ - name: Show diff
105
+ id: show_diff
106
+ run: |
107
+ echo "::set-output name=diff::$(git diff)"
108
+ # 差分があったときは、コミットを作りpushする
109
+ - name: Push
110
+ if: steps.show_diff.outputs.diff != ''
111
+ run: |
112
+ git config user.name "textlint CI"
113
+ git config user.email "textlint_ci@example.com"
114
+ git add -u
115
+ git commit -m "日本語修正"
116
+ git push -f https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/fix-text-${{github.event.pull_request.head.ref}}
117
+ - name: Get PullRequests
118
+ uses: actions/github-script@v3
119
+ if: steps.show_diff.outputs.diff != ''
120
+ id: get_pull_requests
121
+ with:
122
+ github-token: ${{secrets.GITHUB_TOKEN}}
123
+ script: |
124
+ const pulls_list_params = {
125
+ owner: context.repo.owner,
126
+ repo: context.repo.repo,
127
+ head: "kujirahand:fix-text-${{github.event.pull_request.head.ref}}",
128
+ base: "${{github.event.pull_request.head.ref}}",
129
+ state: "open"
130
+ }
131
+ console.log("call pulls.list:", pulls_list_params)
132
+ const pulls = await github.paginate(github.pulls.list, pulls_list_params)
133
+ return pulls.length
134
+ # pushしたブランチでPRを作る
135
+ - name: Create PullRequest
136
+ uses: actions/github-script@v3
137
+ if: steps.show_diff.outputs.diff != '' && steps.get_pull_requests.outputs.result == 0
138
+ with:
139
+ github-token: ${{secrets.GITHUB_TOKEN}}
140
+ script: |
141
+ const common_params = {
142
+ owner: context.repo.owner,
143
+ repo: context.repo.repo
144
+ }
145
+ const pulls_create_params = {
146
+ head: "kujirahand:fix-text-${{github.event.pull_request.head.ref}}",
147
+ base: "${{github.event.pull_request.head.ref}}",
148
+ title: "日本語修正 (修正する場合はPRをマージしてください) #${{github.event.pull_request.number}}",
149
+ body: "日本語を修正しました。本PRをマージすると #${{github.event.pull_request.number}} に修正が適用されます。",
150
+ ...common_params
151
+ }
152
+ console.log("call pulls.create:", pulls_create_params)
153
+ const create_pull_res = (await github.pulls.create(pulls_create_params)).data
154
+ const issues_add_assignees_params = {
155
+ issue_number: create_pull_res.number,
156
+ assignees: ["${{github.event.pull_request.user.login}}"],
157
+ ...common_params
158
+ }
159
+ console.log("call issues.addAssignees:", issues_add_assignees_params)
160
+ await github.issues.addAssignees(issues_add_assignees_params)
161
+ # 既にformat修正のPRがある状態で、手動でformatを修正した場合、format修正のPRを閉じる
162
+ - name: Close PullRequest
163
+ uses: actions/github-script@v3
164
+ if: steps.show_diff.outputs.diff == ''
165
+ with:
166
+ github-token: ${{secrets.GITHUB_TOKEN}}
167
+ script: |
168
+ const head_name = "fix-text-${{github.event.pull_request.head.ref}}"
169
+ const common_params = {
170
+ owner: context.repo.owner,
171
+ repo: context.repo.repo
172
+ }
173
+ const pulls_list_params = {
174
+ head: "kujirahand:" + head_name,
175
+ base: "${{github.event.pull_request.head.ref}}",
176
+ state: "open",
177
+ ...common_params
178
+ }
179
+ console.log("call pulls.list:", pulls_list_params)
180
+ const pulls = await github.paginate(github.pulls.list,pulls_list_params)
181
+
182
+ for (const pull of pulls) {
183
+ const pulls_update_params = {
184
+ pull_number: pull.number,
185
+ state: "closed",
186
+ ...common_params
187
+ }
188
+ console.log("call pulls.update:", pulls_update_params)
189
+ await github.pulls.update(pulls_update_params)
190
+ const git_deleteRef_params = {
191
+ ref: "heads/" + head_name,
192
+ ...common_params
193
+ }
194
+ console.log("call git.deleteRef:", git_deleteRef_params)
195
+ await github.git.deleteRef(git_deleteRef_params)
196
+ }
197
+ - name: Exit
198
+ if: steps.show_diff.outputs.diff != ''
199
+ run: exit 1
package/core/bun.lockb ADDED
Binary file
@@ -0,0 +1,8 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {}
8
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * file: plugin_snako.js
3
+ * 簡単なファイル読み書きのプラグイン
4
+ */
5
+ import path from 'node:path'
6
+ import { exec, OutputMode } from "https://deno.land/x/exec/mod.ts"
7
+
8
+ export default {
9
+ '初期化': {
10
+ type: 'func',
11
+ josi: [],
12
+ pure: true,
13
+ fn: function (sys: any) {
14
+ // command line
15
+ const args = [...Deno.args]
16
+ args.unshift(Deno.execPath())
17
+ // set path
18
+ sys.__getBokanPath = () => {
19
+ let nakofile
20
+ const cmd = path.basename(args[1])
21
+ if (cmd.indexOf('snako') < 0) { nakofile = args[1] } else { nakofile = args[2] }
22
+ return path.dirname(path.resolve(nakofile))
23
+ }
24
+ sys.__v0['コマンドライン'] = args
25
+ sys.__v0['ナデシコランタイムパス'] = args[0]
26
+ sys.__v0['ナデシコランタイム'] = path.basename(args[0])
27
+ sys.__v0['母艦パス'] = sys.__getBokanPath()
28
+ }
29
+ },
30
+ // @SNAKO
31
+ 'コマンドライン': { type: 'const', value: '' },
32
+ 'ナデシコランタイムパス': { type: 'const', value: '' },
33
+ 'ナデシコランタイム': { type: 'const', value: '' },
34
+ '母艦パス': { type: 'const', value: '' },
35
+ '読': { // @ ファイルFの内容を読む // @よむ
36
+ type: 'func',
37
+ josi: [['を', 'から']],
38
+ pure: true,
39
+ asyncFn: true,
40
+ fn: async function (f: string): Promise<string> {
41
+ const text = await Deno.readTextFile(f)
42
+ return text
43
+ }
44
+ },
45
+ '開': { // @ ファイルFの内容を読む // @ひらく
46
+ type: 'func',
47
+ josi: [['を', 'から']],
48
+ pure: true,
49
+ asynfFn: true,
50
+ fn: async function (f: string): Promise<string> {
51
+ const text = await Deno.readTextFile(f)
52
+ return text
53
+ }
54
+ },
55
+ '保存': { // @ 文字列SをファイルFに保存 // @ほぞん
56
+ type: 'func',
57
+ josi: [['を'], ['に', 'へ']],
58
+ pure: true,
59
+ asyncFn: true,
60
+ fn: async function (s: string, f: string): Promise<void> {
61
+ await Deno.writeTextFile(f, s)
62
+ },
63
+ return_none: true
64
+ },
65
+ '起動待機': { // @シェルコマンドSを起動し実行終了まで待機する // @きどうたいき
66
+ type: 'func',
67
+ josi: [['を']],
68
+ pure: true,
69
+ asyncFn: true,
70
+ fn: async function (s: string): Promise<string> {
71
+ const options = { output: OutputMode.Capture, verbose: false }
72
+ const exeRes = await exec(s, options)
73
+ const result = exeRes.output
74
+ return result
75
+ }
76
+ },
77
+ 'ファイル名抽出': { // @フルパスのファイル名Sからファイル名部分を抽出して返す // @ふぁいるめいちゅうしゅつ
78
+ type: 'func',
79
+ josi: [['から', 'の']],
80
+ pure: true,
81
+ fn: function (s: string) {
82
+ return path.basename(s)
83
+ }
84
+ },
85
+ 'パス抽出': { // @ファイル名Sからパス部分を抽出して返す // @ぱすちゅうしゅつ
86
+ type: 'func',
87
+ josi: [['から', 'の']],
88
+ pure: true,
89
+ fn: function (s: string) {
90
+ return path.dirname(s)
91
+ }
92
+ },
93
+ '絶対パス変換': { // @相対パスから絶対パスに変換して返す // @ぜったいぱすへんかん
94
+ type: 'func',
95
+ josi: [['を', 'の']],
96
+ pure: true,
97
+ fn: function (a: string) {
98
+ return path.resolve(a)
99
+ }
100
+ },
101
+ '相対パス展開': { // @ファイル名AからパスBを展開して返す // @そうたいぱすてんかい
102
+ type: 'func',
103
+ josi: [['を'], ['で']],
104
+ pure: true,
105
+ fn: function (a: string, b: string) {
106
+ return path.resolve(path.join(a, b))
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env deno run
2
+ import path from 'node:path'
3
+ import com from '../index.mjs'
4
+ import { NakoGlobal } from '../src/nako_global.mjs'
5
+ import fs from 'node:fs'
6
+
7
+ import * as url from 'node:url'
8
+ import { NakoGenOptions } from '../src/nako_gen.mjs'
9
+ import { NakoCompiler } from '../src/nako3.mjs'
10
+ import PluginSnako from './plugin_snako_deno.ts'
11
+ const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
12
+
13
+ /** コマンドラインオプション */
14
+ class CommandOptions {
15
+ isDebug: boolean
16
+ filename: string
17
+ nodePath: string
18
+ scriptPath: string
19
+ evalStr: string
20
+ flagConvert: boolean
21
+ constructor () {
22
+ this.nodePath = '' // Node.jsではない
23
+ this.scriptPath = ''
24
+ this.filename = ''
25
+ this.evalStr = ''
26
+ this.isDebug = false
27
+ this.flagConvert = false
28
+ }
29
+ }
30
+
31
+ /** メイン処理 */
32
+ async function main (argvOrg: string[]) {
33
+ // コマンドラインオプションを確認
34
+ const argv: string[] = [...argvOrg]
35
+ const opt: CommandOptions = new CommandOptions()
36
+ while (argv.length > 0) {
37
+ const arg = argv.shift() || ''
38
+ if (arg === '-d' || arg === '--debug') {
39
+ opt.isDebug = true
40
+ continue
41
+ }
42
+ if (arg === '-e' || arg === '--eval') {
43
+ opt.evalStr = argv.shift() || ''
44
+ continue
45
+ }
46
+ if (arg === '-c' || arg === '--convert') {
47
+ opt.flagConvert = true
48
+ continue
49
+ }
50
+ if (opt.filename === '') { opt.filename = arg }
51
+ }
52
+ // なでしこのコンパイラを生成
53
+ const nako = new com.NakoCompiler()
54
+ nako.addPluginObject('PluginSnako', PluginSnako)
55
+ // 実行前にイベントを挟みたいとき
56
+ nako.addListener('beforeRun', (g: NakoGlobal) => {
57
+ g.__varslist[0]['ナデシコ種類'] = 'snako'
58
+ })
59
+ // logger を設定 --- リスナーを登録することでデバッグレベルを指定
60
+ const logger = nako.getLogger()
61
+ if (opt.isDebug) {
62
+ logger.addListener('trace', (data: any) => { // --debug オプションを指定したとき
63
+ console.log(data.nodeConsole)
64
+ })
65
+ }
66
+ logger.addListener('stdout', (data: any) => { // 「表示」命令を実行したとき
67
+ console.log(data.noColor)
68
+ })
69
+ // -e オプションを実行したとき
70
+ if (opt.evalStr) {
71
+ await nako.runAsync(opt.evalStr, 'main.nako3')
72
+ return
73
+ }
74
+ // パラメータが空だったとき
75
+ if (opt.filename === '') {
76
+ showHelp()
77
+ return
78
+ }
79
+ // ソースコードをファイルから読み込む
80
+ const code: string = Deno.readTextFileSync(opt.filename)
81
+ // -c オプションが指定されたとき
82
+ if (opt.flagConvert) { convert(nako, code, opt) }
83
+ // 実行
84
+ await nako.runAsync(code, opt.filename)
85
+ }
86
+
87
+ // -c オプションを指定したとき
88
+ function convert (nako: NakoCompiler, code: string, opt: CommandOptions): void {
89
+ // オプションを指定
90
+ const genOpt = new NakoGenOptions(
91
+ false,
92
+ ['nako_errors.mjs', 'nako_core_version.mjs', 'plugin_system.mjs'],
93
+ 'self.__varslist[0][\'ナデシコ種類\'] = \'snako\'')
94
+ // スタンドアロンコードを生成
95
+ const js = nako.compileStandalone(code, opt.filename, genOpt)
96
+ const jsFilename = opt.filename + '.js'
97
+ fs.writeFileSync(jsFilename, js, { encoding: 'utf-8' })
98
+ // 必要なライブラリをコピー
99
+ const runtimeDir = path.join(path.dirname(jsFilename), 'nako3runtime')
100
+ const srcDir = path.join(__dirname, '..', 'src')
101
+ if (!fs.existsSync(runtimeDir)) { fs.mkdirSync(runtimeDir) }
102
+ for (const f of genOpt.importFiles) {
103
+ fs.copyFileSync(path.join(srcDir, f), path.join(runtimeDir, f))
104
+ }
105
+ }
106
+
107
+ /** 使い方を表示 */
108
+ function showHelp (): void {
109
+ console.log('●なでしこ(簡易版) # v.' + com.version.version)
110
+ console.log('[使い方] deno run snako_deno.mts [--debug|-d] (filename)')
111
+ console.log('[使い方] deno run snako_deno.mts [--eval|-e] (source)')
112
+ console.log('[使い方] deno run snako_deno.mts [-c] (source) ... convert')
113
+ }
114
+
115
+ /** メイン処理を実行 */
116
+ main(Deno.args)
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ deno run --allow-read --allow-write deno/snako.ts batch/build_nako_version.nako3
3
+
4
+
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ deno run --allow-read --allow-run \
3
+ deno/snako.ts \
4
+ sample/hello2.nako3
5
+
6
+
7
+