Compare commits

...
Author SHA1 Message Date
LamGC e2778c683b docs: record isolated resource-budget experiment results 2026-10-15 09:53:09 +08:00
LamGC fcaf9be810 test: add isolated resource-budget experiment .github/workflows/resource-budget-experiment.yml 2026-10-15 09:49:35 +08:00
LamGC fd0175cb99 test: add isolated resource-budget experiment experiment/php/scanner-tests.php 2026-10-15 09:49:31 +08:00
LamGC 328bcf6592 test: add isolated resource-budget experiment experiment/php/run.php 2026-10-15 09:49:27 +08:00
LamGC 8a2e42d221 test: add isolated resource-budget experiment experiment/php/preflight.php 2026-10-15 09:49:23 +08:00
LamGC 815a53e211 test: add isolated resource-budget experiment experiment/php/measure.php 2026-10-15 09:49:17 +08:00
LamGC d0f3a06a89 test: add isolated resource-budget experiment experiment/php/README.md 2026-10-15 09:49:08 +08:00
LamGC e44537cd32 test: add isolated resource-budget experiment experiment/browser.cjs 2026-10-15 09:49:04 +08:00
LamGC b27d2ada02 test: add isolated resource-budget experiment experiment/bounded-loader.mjs 2026-10-15 09:49:01 +08:00
LamGC bcca38dec7 test: add isolated resource-budget experiment experiment/README.md 2026-10-15 09:48:58 +08:00
LamGC 7dfc0f4a7a test: add isolated resource-budget experiment experiment/LOCAL-EXPERIMENT.md 2026-10-15 09:48:53 +08:00
LamGC ffff9704e5 ci: isolate installable artifacts and use native Node 24 actions (#40)
Build and upload the pristine package before integration or Plugin Check runs. Consume the immutable current-run artifact by ID and upload only test evidence from disposable consumers.

Pin compatible native Node 24 actions. Preserve the PHP/WordPress matrices and project Node/npm toolchain; verified full CI on Ubuntu 24.04 and an isolated Ubuntu 26.04 canary.
2026-10-15 09:29:32 +08:00
LamGC 16d8400d76 fix: update build dependencies and improve documentation
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s
- Fix gettext-parser 9 compatibility and update Babel parser
- Apply targeted dependency security fixes and align Node.js requirements
- Add regression tests and document remaining dependency risks
- Review bundled player dependencies and advisory reachability
- Reformat English and Chinese READMEs and simplify wording
- Remove plugin version descriptions from README files

PR #39
2026-10-14 17:43:24 +08:00
LamGC 85e5ffa0ec Refresh wp-asciiplayer with native block editor playback (#36)
Build and WordPress integration / PHP 7.4 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / PHP 8.3 syntax and regression tests (push) Canceled after 0s
Build and WordPress integration / WordPress 6.3 / PHP 7.4 (push) Canceled after 0s
Build and WordPress integration / WordPress latest / PHP 8.2 (push) Canceled after 0s
* Refresh player with native block editor preview and local assets

Preserve shortcode rendering, normalize options, bundle the player locally,
and add reproducible packaging and WordPress integration tests.

* Fix emitted frontend boot and verify bundled runtime initialization

* Record verified WordPress 7.1.3 compatibility

* Use WordPress readme major-version compatibility format

* Add responsive player layout, captions and native terminal sizing

* Keep editor caption geometry stable during block selection

* Respect WordPress editor gutters with border-box sizing

* Improve automatic previews and toolbar terminal sizing (1.2.1)

* Show native cast dimensions and add Media Library recordings (1.2.2)

* Fix Media Library test storage and scope sidebar selectors

* Document bounded temporary-upload stream exceptions

* Move block explanations into collapsed sidebar help (1.2.3)

* Add bundled English and Simplified Chinese UI translations (1.1.0-dev)

* Use native RichText labels and supported Chinese HTML language tags in locale tests
2026-10-14 15:56:05 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 40e2bf0733 build(deps): Bump asciinema-player from 3.6.3 to 3.7.0 in /asciiplayer (#23)
Bumps [asciinema-player](https://github.com/asciinema/asciinema-player) from 3.6.3 to 3.7.0.
- [Release notes](https://github.com/asciinema/asciinema-player/releases)
- [Commits](https://github.com/asciinema/asciinema-player/compare/v3.6.3...v3.7.0)

---
updated-dependencies:
- dependency-name: asciinema-player
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:13:09 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> c059193e68 build(deps-dev): Bump css-loader from 6.8.1 to 6.10.0 in /asciiplayer (#18)
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 6.8.1 to 6.10.0.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v6.8.1...v6.10.0)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:35 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ac193bf521 build(deps-dev): Bump mini-css-extract-plugin in /asciiplayer (#25)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 2.7.6 to 2.8.1.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v2.7.6...v2.8.1)

---
updated-dependencies:
- dependency-name: mini-css-extract-plugin
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:20 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> bb93413eda build(deps-dev): Bump webpack from 5.89.0 to 5.90.3 in /asciiplayer (#24)
Bumps [webpack](https://github.com/webpack/webpack) from 5.89.0 to 5.90.3.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.89.0...v5.90.3)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:09 +08:00
123 changed files with 33606 additions and 2081 deletions
+2
View File
@@ -0,0 +1,2 @@
# Preserve verbatim upstream license texts (some use CRLF or trailing spaces).
licenses/* -whitespace
+3 -8
View File
@@ -1,11 +1,6 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2 version: 2
updates: updates:
- package-ecosystem: "npm" # See documentation for possible values - package-ecosystem: npm
directory: "/asciiplayer" # Location of package manifests directory: /
schedule: schedule:
interval: "daily" interval: daily
+191
View File
@@ -0,0 +1,191 @@
name: Build and WordPress integration
on:
pull_request:
push:
branches: ['main', 'codex/**']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
php-compatibility:
name: PHP ${{ matrix.php }} syntax and regression tests
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.3']
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Check syntax and execute PHP regression tests
run: |
docker run --rm -v "$PWD:/app" -w /app "php:${{ matrix.php }}-cli" sh -ec '
find . -type f -name "*.php" -not -path "./node_modules/*" -print0 | xargs -0 -n1 php -l
php tests/php/run.php
'
# Only this job publishes the installable package. No WordPress containers or
# downloaded plugins run here, and the artifact is immutable once uploaded.
build:
name: Build and publish pristine package
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
package-artifact-id: ${{ steps.package.outputs.artifact-id }}
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '24.18.0'
cache: npm
- name: Use the documented npm toolchain
run: npm install --global [email protected]
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run package
- name: Upload pristine installable ZIP
id: package
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: wp-asciiplayer-package-${{ github.run_id }}-${{ github.run_attempt }}
path: dist/wp-asciiplayer.zip
if-no-files-found: error
retention-days: 14
wordpress:
needs: build
name: WordPress ${{ matrix.wordpress }} / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- wordpress: 'latest'
php: '8.2'
- wordpress: '6.3'
php: '7.4'
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '24.18.0'
cache: npm
- name: Use the documented npm toolchain
run: npm install --global [email protected]
- run: npm ci
- name: Download the pristine package from this run
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
artifact-ids: ${{ needs.build.outputs.package-artifact-id }}
path: dist
merge-multiple: true
- name: Configure clean WordPress version
env:
WP_TEST_VERSION: ${{ matrix.wordpress }}
WP_TEST_PHP: ${{ matrix.php }}
run: |
node --input-type=module <<'JS'
import fs from 'node:fs';
fs.writeFileSync('.wp-env.override.json', JSON.stringify({
core: process.env.WP_TEST_VERSION === 'latest' ? null : `https://wordpress.org/wordpress-${process.env.WP_TEST_VERSION}.zip`,
phpVersion: process.env.WP_TEST_PHP,
}, null, 2));
JS
- name: Start real WordPress and install only the packaged plugin
run: |
mkdir -p .wp-env-uploads
npx --no-install wp-env start
npx --no-install wp-env run cli wp plugin install /var/www/html/wp-content/asciiplayer-packages/wp-asciiplayer.zip --activate --force
npx --no-install wp-env run cli wp plugin is-active wp-asciiplayer
npx --no-install wp-env run cli wp core version | tee wordpress-version.txt
npx --no-install wp-env run cli wp plugin list
npx --no-install wp-env run cli wp language core install zh_CN
npx --no-install wp-env run cli wp site switch-language en_US
npx --no-install wp-env run cli wp user meta update admin locale en_US
- name: Install Chromium
run: npx --no-install playwright install --with-deps chromium
- name: Exercise editor iframe, saved blocks, Pages, posts and legacy shortcodes
env:
PLAYWRIGHT_HTML_OUTPUT_DIR: playwright-report/en-US
run: npm run test:e2e -- --grep-invert @i18n --output=test-results/en-US
- name: Exercise real en_US and zh_CN site and user locale combinations
env:
PLAYWRIGHT_HTML_OUTPUT_DIR: playwright-report/i18n
run: npm run test:e2e -- --grep @i18n --output=test-results/i18n
- name: Record WordPress and PHP logs
if: always()
run: |
npx --no-install wp-env logs --watch=false > wordpress-logs.txt 2>&1 || true
npx --no-install wp-env run cli sh -c 'test ! -f wp-content/debug.log || cat wp-content/debug.log' > wordpress-debug.txt 2>&1 || true
- name: Upload integration evidence
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: wordpress-${{ matrix.wordpress }}-php-${{ matrix.php }}
if-no-files-found: warn
retention-days: 14
path: |
playwright-report/
test-results/
wordpress-version.txt
wordpress-logs.txt
wordpress-debug.txt
- name: Stop WordPress
if: always()
run: npx --no-install wp-env stop
# Plugin Check receives its own disposable copy. It cannot replace the package
# uploaded by build, and this job never republishes files from dist.
plugin-check:
name: Plugin Check (advisory)
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '24.18.0'
cache: npm
- name: Use the documented npm toolchain
run: npm install --global [email protected]
- run: npm ci
- name: Download the pristine package from this run
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
artifact-ids: ${{ needs.build.outputs.package-artifact-id }}
path: dist
merge-multiple: true
- name: Start WordPress and install the packaged plugin
run: |
mkdir -p .wp-env-uploads
npx --no-install wp-env start
npx --no-install wp-env run cli wp plugin install /var/www/html/wp-content/asciiplayer-packages/wp-asciiplayer.zip --activate --force
- name: Run Plugin Check (advisory until directory review)
continue-on-error: true
run: |
npx --no-install wp-env run cli wp plugin install plugin-check --activate
npx --no-install wp-env run cli wp plugin get plugin-check --field=version | tee plugin-check-version.txt
npx --no-install wp-env run cli wp plugin check wp-asciiplayer --require=/var/www/html/wp-content/plugins/plugin-check/cli.php --format=json | tee plugin-check-report.txt
- name: Upload Plugin Check evidence only
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: plugin-check-${{ github.run_id }}-${{ github.run_attempt }}
if-no-files-found: warn
retention-days: 14
path: |
plugin-check-version.txt
plugin-check-report.txt
- name: Stop WordPress
if: always()
run: npx --no-install wp-env stop
@@ -0,0 +1,61 @@
name: Isolated recording resource-budget experiment
on:
push:
branches: ['experiment/cast-resource-budgets-20261015']
paths: ['experiment/**', '.github/workflows/resource-budget-experiment.yml']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: resource-budget-experiment-${{ github.ref }}
cancel-in-progress: true
jobs:
browser:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
persist-credentials: false
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38
with:
node-version: '24.18.0'
cache: npm
- run: npm ci --ignore-scripts
- run: npx --no-install playwright install --with-deps chromium
- name: Controlled real-browser comparison
run: timeout 360s node --max-old-space-size=512 experiment/browser.cjs
- name: Retain experiment evidence
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: resource-budget-browser-${{ github.run_id }}-${{ github.run_attempt }}
path: experiment/results/browser/
if-no-files-found: error
retention-days: 7
php:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.3']
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
persist-credentials: false
- name: Pull official PHP runtime
run: docker pull php:${{ matrix.php }}-cli
- name: Native PHP controlled comparison
run: |
mkdir -p experiment/results/php
docker image inspect php:${{ matrix.php }}-cli --format '{{json .RepoDigests}}' > experiment/results/php/image-digest.json
timeout 240s docker run --rm --network none --memory=512m --cpus=2 --read-only --tmpfs /tmp:rw,size=256m -v "$PWD:/repo:ro" -v "$PWD/experiment/results/php:/results:rw" -w /repo php:${{ matrix.php }}-cli php -d memory_limit=128M experiment/php/run.php /repo /results
- name: Retain experiment evidence
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: resource-budget-php-${{ matrix.php }}-${{ github.run_id }}-${{ github.run_attempt }}
path: experiment/results/php/
if-no-files-found: error
retention-days: 7
+6
View File
@@ -49,3 +49,9 @@ wp-config.php
.idea/ .idea/
dist/ dist/
/node_modules/
/build/
/playwright-report/
/test-results/
/.wp-env/
/.wp-env-uploads/
+19
View File
@@ -0,0 +1,19 @@
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"core": null,
"phpVersion": "8.2",
"port": 8888,
"plugins": [],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"SCRIPT_DEBUG": true
},
"mappings": {
"wp-content/uploads": "./.wp-env-uploads",
"wp-content/uploads/asciiplayer-fixtures": "./tests/fixtures",
"wp-content/asciiplayer-packages": "./dist"
},
"testsEnvironment": false
}
+97 -18
View File
@@ -1,33 +1,112 @@
# wp-asciiplayer # wp-asciiplayer
把 AsciiCast 添加到你的文章! 把终端录屏放进 WordPress 文章和页面。添加 **Asciicast Player** 区块,就能一边编辑一边预览录屏;
旧文章里的 `[asciiplayer]` shortcode 也可以继续使用。
## 快速开始 [English documentation](README.md)
在文章中添加一个简码,然后输入以下内容: ## 安装
``` 需要 **WordPress 6.3+** 和 **PHP 7.4+**。
[asciiplayer]https://asciinema.org/a/28307.cast[/asciiplayer]
1. 在 **插件 → 安装插件 → 上传插件** 中上传构建好的 `wp-asciiplayer.zip`。
2. 启用 **Asciicast Player**。
GitHub 下载的源码 ZIP 需要先构建,不能直接安装,步骤见[构建说明](SOURCE.md)。
[仓库 CI](.github/workflows/ci.yml) 列出了测试的环境组合;使用前也请检查与你的主题是否兼容。
## 添加录屏
1. 插入 **Asciicast Player** 区块。
2. 粘贴录制文件的 URL,或点击 **选择录制文件(Choose recording)**,从媒体库选择或上传 `.cast` 文件。
3. 停止输入约半秒后会自动加载预览。点击 **Apply URL** 可以立即加载,然后就能播放、暂停和拖动进度。
4. 在 **Display** 中设置宽度和对齐方式。可以选择预设,也可以填写 `480px`、`65%` 等 CSS 长度。
播放器下方可以添加说明文字。
5. 在区块设置中调整主题、速度、循环、控制栏、适应方式、起始时间和空闲压缩,然后保存文章或页面。
重新打开文章时,已有有效 URL 的区块会自动加载录屏。编辑预览不会自动播放,即使你给前台启用了自动播放。
空白或无效 URL 不会发起请求。区块插入器里的示例是静态的,也不会请求录制文件。
### 展示宽度与终端尺寸
展示宽度决定播放器在页面里占多大空间,并且不会超出可用宽度。
调整宽度或使用 `fit: width` 只是缩放画面,不会改变终端的行列数。
**Columns** 和 **Rows** 留空时,会使用录屏本身的尺寸,并跟随录制中的尺寸变化。
需要手动设置时,可以使用区块工具栏或侧栏里的 **Terminal size**,两处设置会同步。
点击 **Use recording size** 可以清空手动设置,恢复录屏原有尺寸。
加载后,空白字段会显示录屏的原始行列数作为提示。换一个 URL 会刷新提示,但保留你手动填写的值。
提示只读取同一次预览响应的前 **64 KiB**;读取不到时保留通用占位提示,不猜测尺寸。
录制过程中后续的尺寸变化不会改变这组提示。
播放器自带样式,用来保持终端文字对齐和键盘焦点可见。部分主题可能仍需要调整 CSS。
播放操作和录屏隐私说明可以在侧栏的 **帮助(Help)** 面板中找到。
### 录制文件地址
URL 要直接指向录制文件,例如 `.cast` 文件,而不是 asciinema 分享页面。
其他域名上的文件需要允许来自你站点的 CORS 请求。HTTPS 页面可能无法加载 HTTP 文件,优先使用同站点的 HTTPS 地址。
插件不会代理请求或复制远程文件。
## 旧文章与 shortcode
旧文章可以继续使用原有 shortcode,不需要批量修改:
```text
[asciiplayer]https://example.org/demo.cast[/asciiplayer]
[asciiplayer theme="monokai" speed="1.5" controls="false"]https://example.org/demo.cast[/asciiplayer]
[asciiplayer startAt="2" idleTimeLimit="3" style="width: 80%;"]https://example.org/demo.cast[/asciiplayer]
``` ```
简码的内容为 asciicast 文件的 URL。 布尔值、数值和旧的 camelCase 参数会自动处理。自定义 `style` 会经过 WordPress 的安全 CSS 过滤;
不安全的 URL、标记,以及可执行或对象形式的选项不会被接受。
### 选项 支持的 shortcode 可以转换成区块,保存前请检查设置。插件不会自动重写旧文章。
经典编辑器仍可使用 shortcode,但没有专门的播放器编辑界面。
AsciiPlayer 简码支持 asciinema-player 所支持的选项,例如设置 `fit` 为 `height` 并关闭控制栏: ## 媒体库上传
``` 已有 WordPress `upload_files` 权限的用户可以上传 `.cast` 文件。
[asciiplayer fit="height" controls="false"]https://asciinema.org/a/28307.cast[/asciiplayer] 多站点还需要网络管理员允许 `cast` 扩展名。插件不会增加用户的上传权限,也不会另建录屏管理文章类型。
```
你可以在[这里](https://www.npmjs.com/package/asciinema-player#options)找到所有可用的选项。 上传文件会完整校验,限制如下:
> 目前只有 `logger` 选项不受支持,因为这个选项需要传入一个对象。 - 每个文件最多 **32 MiB**。
- 最多 **100,000** 个事件或流内行。
- 每条 JSONL 行最多 **256 KiB**。
- 终端任一方向不超过 **1,000** 列或行。
#### 样式选项 旧的 asciicast v1 格式最多 **2 MiB**,需要格式化 JSON,并让起始 `{` 单独占一行;
内置播放器无法读取压成一行的 v1 文件。Asciicast v2、v3 使用标准 JSONL。
站点或服务器更低的上传限制仍然生效。无效录屏会被拒绝,也不会因此开放普通 JSON、HTML 或 SVG 上传。
为了方便自定义播放器元素,插件额外添加了 `style` 选项,该选项会直接控制 Asciinema-player 容器元素的样式: ## 界面语言
``` 插件界面包含英文和简体中文(`zh_CN`):
[asciiplayer style="width: 80%;"]https://asciinema.org/a/28307.cast[/asciiplayer]
``` - 编辑器跟随 **用户 → 个人资料 → 语言**;未单独设置时使用站点语言。
- 前台跟随 **设置 → 常规 → 站点语言**。
翻译文件随 ZIP 附带,可离线使用。英文是默认回退语言,不需要单独的 `en_US` 翻译文件。
`zh_TW` 等其他中文地区设置不会自动映射成简体中文。
录屏中的终端内容和你填写的说明文字不会被翻译。
内置播放器自身的播放控件和帮助仍为英文,其文件保持上游原样。
## 资源与隐私
播放器的 JavaScript、CSS 和 WebAssembly 都在插件内,不会从 jsDelivr 加载。
插件没有统计追踪,也不会在后台调用远程 API。旧的 `ap_use_local_resources` 选项不再使用。
录屏文件会由浏览器直接请求你填写的 URL。外部主机可能收到读者的 IP 地址、浏览器请求信息,
以及浏览器和站点设置允许发送的来源信息。编辑预览也会发起同样的请求,包括重新打开已有录屏的文章时。
请使用可信主机,发布前检查终端录屏是否含有敏感信息。
外部主机适用自己的隐私政策,插件无法让外部录屏变成私有文件。
## 构建与许可
构建、测试和 ZIP 打包步骤见 [SOURCE.md](SOURCE.md)。
插件使用 GPL-3.0-only。播放器和依赖保留各自的兼容许可证,详见[第三方许可证](THIRD-PARTY-NOTICES.md)。
+120 -21
View File
@@ -1,37 +1,136 @@
# wp-asciiplayer # wp-asciiplayer
Play Ascicast files in the post! Play terminal recordings in WordPress posts and pages. Add an **Asciicast Player**
block to preview the recording while you edit, or keep using the `[asciiplayer]`
shortcode in existing posts.
[中文文档](README-zh.md) [中文说明](README-zh.md)
## Quick start ## Install
Add a shortcode to the post and enter the following: Requires **WordPress 6.3+** and **PHP 7.4+**.
``` 1. Upload the built `wp-asciiplayer.zip` through **Plugins → Add New → Upload Plugin**.
[asciiplayer]https://asciinema.org/a/28307.cast[/asciiplayer] 2. Activate **Asciicast Player**.
A GitHub source ZIP needs to be built before you can install it. See the
[build instructions](SOURCE.md). The [CI workflow](.github/workflows/ci.yml)
lists the combinations we test; check the plugin with your own theme too.
## Add a recording
1. Insert an **Asciicast Player** block.
2. Paste a recording-file URL, or click **Choose recording** to select or upload a
`.cast` file from the Media Library.
3. The preview loads about half a second after you stop typing. Click **Apply URL**
to load it immediately, then play, pause or seek through the recording.
4. Use **Display** to set the width and alignment. You can choose a preset or enter
a CSS length such as `480px` or `65%`. Add a caption below the player.
5. Adjust the theme, speed, looping, controls, fit, start time and idle-time limit
in the block settings, then save your post or page.
Saved recordings load again when you reopen the editor. Previews do not autoplay,
even if you enable autoplay for the published page. Empty or invalid URLs do not
start a request. The block inserter uses a static example, so it does not fetch a
recording either.
### Display width and terminal size
The display width controls how much space the player takes on the page. It stays
within the available width. Changing it, or using `fit: width`, scales the picture
without changing the terminal's columns and rows.
Leave **Columns** and **Rows** empty to use the recording's dimensions and resize
events. To override them, use **Terminal size** in the block toolbar or sidebar;
both controls update the same settings. **Use recording size** clears the overrides.
After loading, the empty fields show the recording's original dimensions as hints.
Changing the URL updates those hints but keeps any values you entered. The hints
come from the first 64 KiB of the preview response; if they cannot be read, the
fields keep a generic placeholder. Later resize events do not change the hints.
The player includes styles to keep terminal text aligned and keyboard focus
visible. Some themes may still need CSS adjustments. Playback tips and recording
privacy information are in the sidebar's **Help** panel.
### Recording URLs
Use an HTTP(S) URL that points to the recording file, not an asciinema share page.
A file hosted on another domain must allow CORS requests from your site. Browsers
may block HTTP recordings on HTTPS pages; a same-site HTTPS URL is the simplest
option. The plugin does not proxy or copy remote files.
## Existing shortcodes
Existing posts keep working without a content migration:
```text
[asciiplayer]https://example.org/demo.cast[/asciiplayer]
[asciiplayer theme="monokai" speed="1.5" controls="false"]https://example.org/demo.cast[/asciiplayer]
[asciiplayer startAt="2" idleTimeLimit="3" style="width: 80%;"]https://example.org/demo.cast[/asciiplayer]
``` ```
The content of the shortcode is the URL of the ascicast file. Boolean, numeric and older camelCase options are handled automatically. Inline
styles go through WordPress's safe-CSS filter; unsafe URLs, markup and executable
or object-valued options are not accepted.
### Options You can convert supported shortcodes into blocks. Check the settings before
saving; the plugin never rewrites old posts automatically. The Classic Editor
supports shortcodes, but has no custom player-editing interface.
The AsciiPlayer shortcode supports the options supported by Asciinema-player, such as setting `fit` to `height` and closing the control bar: ## Media Library uploads
``` You can upload `.cast` files if your account already has WordPress's `upload_files`
[asciiplayer fit="height" controls="false"]https://asciinema.org/a/28307.cast[/asciiplayer] permission. Multisite networks must also allow the `cast` extension. The plugin
``` does not grant extra upload permissions or add a separate recording-management
post type.
You can find all available options [here](https://www.npmjs.com/package/asciinema-player#options). Uploads are checked against these limits:
> Currently, only the `logger` option is not supported because it requires an object to be passed in. - **32 MiB** per file.
- **100,000** events or stream lines.
- **256 KiB** per JSONL line.
- **1,000** columns or rows in either direction.
#### Style options The older asciicast v1 format is limited to **2 MiB**. Its JSON must be
pretty-printed, with the opening `{` on a line of its own; the bundled player
cannot read compact, single-line v1 files. Asciicast v2 and v3 use standard JSONL.
Lower site or server upload limits still apply. Invalid recordings are rejected;
this does not enable general JSON, HTML or SVG uploads.
For the convenience of customizing player elements, ## Languages
the plugin has added an additional `style` **option**,
which corresponds to the `style` **attribute** of the player container element:
``` The plugin's interface includes English and Simplified Chinese (`zh_CN`).
[asciiplayer style="width: 80%;"]https://asciinema.org/a/28307.cast[/asciiplayer]
``` - In the editor, choose **Users → Profile → Language**, or use the site default.
- On public pages, the language follows **Settings → General → Site Language**.
Translations are included in the ZIP and work offline. English is the fallback;
there is no separate `en_US` catalog. Other Chinese locales, including `zh_TW`, are
not automatically mapped to Simplified Chinese.
Recorded terminal output and your captions are unchanged. The bundled player's
own playback controls and help remain in English; its files are kept as supplied
by the upstream project.
## Resources and privacy
The player’s JavaScript, CSS and WebAssembly are bundled locally. The plugin does
not contact jsDelivr, add analytics or make background remote API calls. The old
`ap_use_local_resources` option is no longer used.
Recordings are different: visitors' browsers fetch the URL you choose directly.
An external host may receive their IP address, browser request details and a
referrer, depending on browser and site settings. Editor previews make the same
request whenever a valid URL loads, including when you reopen a saved block.
Use a trusted host and check recordings for sensitive terminal output before
publishing. The host's privacy policy applies; the plugin cannot make an external
recording private.
## Build and license
See [SOURCE.md](SOURCE.md) for build, test and ZIP packaging commands.
The plugin is GPL-3.0-only. The player and its dependencies keep their own
compatible licenses; see [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
+64
View File
@@ -0,0 +1,64 @@
# Source and reproducible build
This distribution contains the plugin's PHP and JavaScript source, block metadata,
build configuration, scripts, and npm lockfile. The development repository is
https://github.com/LamGC/wp-asciiplayer .
Use Node.js 24.18+ (24.x) or 26+, npm 11.16+, and the standard `zip` command:
npm ci
npm run build
npm run package
Node.js 22 and 25 are not supported by the complete development toolchain.
The Node requirement is for building/testing only; the plugin still supports
WordPress 6.3 and PHP 7.4.
The installable output is `dist/wp-asciiplayer.zip`. Generated assets are never
loaded from a CDN. `scripts/vendor.mjs` copies the pinned official npm
`[email protected]` distribution, verified by package-lock integrity, into
`build/player.js` and `build/player.css`. WordPress-provided JavaScript packages
are externalized by @wordpress/scripts, not bundled with a second React.
The upstream player's corresponding source and build instructions are at
https://github.com/asciinema/asciinema-player/tree/v3.17.0 . Its JavaScript bundle
includes the upstream terminal WebAssembly implementation. Third-party notices
and applicable license texts are included alongside this file.
Development tests require the full repository (tests are not in the install ZIP):
npm test
npm run test:php
npm run wp-env -- start
npm run test:e2e
PHP tests require a PHP runtime. WordPress integration tests require Docker and
Chromium; the repository CI records the exact WordPress version under test and
installs the release ZIP into the test site before checking it. Refer to the
workflow for setup details. Running a unit test is not a substitute for the
WordPress browser integration suite.
## Translation maintenance
The English gettext strings are the fallback. Edit `languages/wp-asciiplayer-zh_CN.po`
to maintain Simplified Chinese; `npm run i18n` extracts the current static PHP/JS
and block-metadata strings into the POT and compiles the MO and WordPress Jed JSON.
`npm run i18n:check` fails for missing/fuzzy translations, stale generated files,
unsupported plural extraction, and mismatched printf placeholders. Build runs
compilation and tests check it reproducibly, without a network service or timestamps.
For new strings, run `node scripts/i18n.mjs --pot-only`, merge into the maintained
PO with a gettext editor, translate, and run `npm run i18n` again.
JSON files use WordPress's supported domain-locale-script-handle names for the
actual `lamgc-asciiplayer-editor` and `lamgc-asciiplayer-view` handles. The editor
bundle has no lazy translated chunks. `wp_set_script_translations` registers both
paths after scripts; PHP registers `load_plugin_textdomain` during `init`, before
block metadata is translated. The generated assets and all catalogs are packaged.
The upstream vendor bundle is byte-for-byte unchanged and its own controls remain
English. Runtime JS/CSS versions use build content hashes even though the preview
package version stays `1.1.0-dev`.
References:
- https://developer.wordpress.org/reference/functions/wp_set_script_translations/
- https://developer.wordpress.org/reference/functions/load_script_textdomain/
- https://developer.wordpress.org/reference/functions/load_plugin_textdomain/
+127
View File
@@ -0,0 +1,127 @@
# Third-party notices
The WordPress plugin's own code is licensed under GPL-3.0-only; see the root
`LICENSE`. The third-party components below retain their respective licenses.
This file records attribution and provenance and does not replace those terms.
## asciinema-player 3.17.0
- Author: Marcin Kulik. The upstream license includes
“Copyright 2011-2021 Marcin Kulik”.
- Upstream source: https://github.com/asciinema/asciinema-player/tree/v3.17.0
- npm package: https://www.npmjs.com/package/asciinema-player/v/3.17.0
- License: Apache-2.0. Full upstream text: `licenses/asciinema-player-LICENSE`.
- The embedded terminal implementation in `src/vt` also provides MIT and
Apache-2.0 texts, preserved as `licenses/vt-js-LICENSE-MIT` and
`licenses/vt-js-LICENSE-APACHE`. Its MIT notice is
“Copyright (c) 2018 Marcin Kulik <m@ku1ik.com>”.
`scripts/vendor.mjs` copies the official npm standalone JavaScript and CSS
byte-for-byte into `build/player.js` and `build/player.css`, respectively.
It does not rebuild or modify the upstream player. The JavaScript includes
the upstream Apache-2.0 license banner and an inline WebAssembly module.
Verified SHA-256 hashes of the original npm files:
- `dist/bundle/asciinema-player.min.js`:
`a13c37632e1b5c49fe9128417b9319a9b5bc64cb457dd5ae52cbba8a3aceb880`
- `dist/bundle/asciinema-player.css`:
`f619fe17597043564f03b2c6918b3daf890ee8b912fb408542fba11afade4fdb`
The upstream v3.17.0 source tree contains the three license files above and
no separate NOTICE file. Recheck this when updating the player.
## JavaScript dependency notices
The following versions are from the upstream player's v3.17.0
`package-lock.json`, rather than this plugin's newer resolved installation
dependencies. Their MIT license texts, including copyright notices, are
preserved under `licenses/`.
| Package | Upstream lock version | License file |
| --- | --- | --- |
| @babel/runtime | 7.27.0 | babel-runtime-LICENSE |
| solid-js | 1.9.6 | solid-js-LICENSE |
| solid-transition-group | 0.2.3 | solid-transition-group-LICENSE |
| @solid-primitives/refs | 1.1.2 | solid-primitives-LICENSE |
| @solid-primitives/transition-group | 1.1.2 | solid-primitives-LICENSE |
| @solid-primitives/utils | 6.3.2 | solid-primitives-LICENSE |
| regenerator-runtime | 0.14.1 | regenerator-runtime-LICENSE |
| seroval | 1.5.0 | seroval-LICENSE |
| seroval-plugins | 1.3.0 | seroval-plugins-LICENSE |
| csstype | 3.1.1 | csstype-LICENSE |
This conservatively covers all non-development dependency entries in that
upstream npm lockfile. It does not assert that every package, type definition,
or function survives the upstream browser build's tree-shaking.
`licenses/upstream-npm-production-dependencies.json` records these entries.
## Rust / WebAssembly dependency notices
The following is the dependency closure of the normal dependencies declared
by `src/vt/Cargo.toml`, using the versions in upstream v3.17.0
`src/vt/Cargo.lock`. It includes compile-time macro dependencies, even where
their own runtime code is not shipped. The original lockfile is preserved as
`licenses/upstream-asciinema-player-Cargo.lock`.
For projects offering MIT as an alternative license, the MIT text is included
here. The upstream projects retain any other licensing options they offer.
| Package | Upstream lock version | Included license text |
| --- | --- | --- |
| allocator-api2 | 0.4.0 | allocator-api2-LICENSE (MIT) |
| avt | 0.16.0 | avt-LICENSE (Apache-2.0) |
| bumpalo | 3.12.0 | bumpalo-LICENSE (MIT) |
| bytemuck | 1.18.0 | bytemuck-LICENSE (MIT) |
| cfg-if | 1.0.0 | cfg-if-LICENSE (MIT) |
| itoa | 1.0.5 | itoa-LICENSE (MIT) |
| js-sys | 0.3.61 | js-sys-LICENSE (MIT) |
| lock_api | 0.4.14 | lock_api-LICENSE (MIT) |
| once_cell | 1.17.1 | once_cell-LICENSE (MIT) |
| proc-macro2 | 1.0.84 | proc-macro2-LICENSE (MIT) |
| quote | 1.0.36 | quote-LICENSE (MIT) |
| rgb | 0.8.50 | rgb-LICENSE (MIT) |
| rustversion | 1.0.22 | rustversion-LICENSE (MIT) |
| ryu | 1.0.12 | ryu-LICENSE (Apache-2.0) |
| scopeguard | 1.2.0 | scopeguard-LICENSE (MIT) |
| serde, serde_derive | 1.0.203 | serde-LICENSE (MIT) |
| serde-wasm-bindgen | 0.6.5 | serde-wasm-bindgen-LICENSE (MIT) |
| serde_json | 1.0.93 | serde_json-LICENSE (MIT) |
| syn | 2.0.66 | syn-LICENSE (MIT) |
| talc | 5.0.3 | talc-LICENSE (MIT) |
| unicode-ident | 1.0.6 | unicode-ident-MIT-LICENSE and unicode-ident-LICENSE (Unicode data terms) |
| unicode-width | 0.1.14 | unicode-width-LICENSE (MIT), unicode-width-COPYRIGHT-LICENSE |
| wasm-bindgen, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared | 0.2.106 | wasm-bindgen-LICENSE (MIT) |
The `js-sys` license comes from its corresponding wasm-bindgen 0.2.84
source release. Test-only dependency branches in the upstream Rust lockfile
are not represented as shipped components.
The upstream `flake.nix` pins Rust 1.85.0, which also appears in source-path
strings in the supplied WASM. Rust's MIT and Apache-2.0 texts and copyright
inventory are preserved as `rust-1.85.0-LICENSE-MIT`,
`rust-1.85.0-LICENSE-APACHE`, and `rust-1.85.0-COPYRIGHT`.
Rust 1.85.0's library lockfile selects compiler_builtins 0.1.140; that project's
combined MIT and Apache-2.0 WITH LLVM-exception text is preserved as
`compiler-builtins-LICENSE`, with the referenced upstream compiler-rt
contributor list in `compiler-rt-CREDITS`. These compiler-runtime notices are
included conservatively; they are not a claim that every standard-library
dependency listed in Rust's source distribution is linked into this player.
## Provenance and verification limits
`licenses/SOURCES.json` identifies the source of each preserved text.
These are source-based notices for the official upstream bundle, not an
independently generated binary SBOM or a legal audit. The dependency versions
above are the upstream source lockfile entries; this plugin's build does not
resolve or rebuild that embedded Rust code. The supplied WASM independently
contains paths identifying avt 0.16.0, unicode-width 0.1.14,
serde-wasm-bindgen 0.6.5, and wasm-bindgen 0.2.106. It does not expose a complete
machine-readable inventory of all compiled dependencies.
When changing the player version or rebuilding it from source, review the
new lockfiles, actual linked components, copyright/NOTICE files, compiler
runtime, and any added dependencies; update this inventory and preserved
texts before distribution. Keep this file and the complete `licenses/`
directory in the plugin release ZIP. Source and build instructions are in
`SOURCE.md`.
+32 -91
View File
@@ -1,100 +1,41 @@
<?php <?php
/**
/* * Plugin Name: Asciicast Player
Plugin Name: Asciicast Player * Plugin URI: https://github.com/LamGC/wp-asciiplayer
Plugin URI: https://github.com/LamGC/wp-asciiplayer * Description: Add interactive terminal recordings to posts and pages with a block or shortcode.
Description: AsciinemaPlayer for WordPress. * Version: 1.1.0-dev
Version: 1.0.0 * Requires at least: 6.3
Author: LamGC * Requires PHP: 7.4
Author URI: https://blog.lamgc.moe * Author: LamGC
License: GNU GENERAL PUBLIC LICENSE Version 3.0 * Author URI: https://blog.lamgc.moe
* License: GPL-3.0-only
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Domain Path: /languages
* Text Domain: wp-asciiplayer
*
* @package LamGC\Asciiplayer
*/ */
const PLUGIN_VERSION = '1.0.1'; namespace LamGC\Asciiplayer;
const ASCIIPLAYER_TAG = 'asciiplayer'; if ( ! defined( 'ABSPATH' ) ) {
exit;
const AP_OPTION_USE_LOCAL_RESOURCES = 'ap_use_local_resources';
// 是否使用本地资源, 如果可以的话, 建议使用 CDN.
add_option(AP_OPTION_USE_LOCAL_RESOURCES, false, $autoload = true);
function handle_asciiplayer_code($attr = [], string $content = null): string
{
if (!isset($content)) {
return '';
}
$content = trim($content);
if (!is_array(wp_parse_url($content))) {
return '';
}
$opts = is_assoc($attr) ? $attr : [];
set_default_value($opts, 'preload', true);
$style = null;
if (isset($opts['style']) && is_string($opts['style'])) {
$style = $opts['style'];
}
unset($opts['style']);
$opts_json = urlencode_deep(json_encode($opts));
return "<div
class=\"asciiplayer-container\"
data-ap-src=\"$content\"
data-ap-opts=\"$opts_json\"
data-ap-style=\"$style\"
></div>";
} }
function is_assoc($arr): bool const VERSION = '1.1.0-dev';
{ const PLUGIN_FILE = __FILE__;
if (!is_array($arr)) return false; const SHORTCODE = 'asciiplayer';
if (array() === $arr) return false;
return array_keys($arr) !== range(0, count($arr) - 1);
}
require_once __DIR__ . '/includes/options.php';
require_once __DIR__ . '/includes/render.php';
require_once __DIR__ . '/includes/assets.php';
require_once __DIR__ . '/includes/uploads.php';
function set_default_value(array &$array, string $key, $value) add_action( 'init', __NAMESPACE__ . '\\register_plugin' );
{ add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\enqueue_content_assets' );
if (!isset($array[$key])) { add_action( 'wp_footer', __NAMESPACE__ . '\\print_late_styles', 5 );
$array[$key] = $value;
}
}
add_shortcode(ASCIIPLAYER_TAG, 'handle_asciiplayer_code'); add_filter( 'upload_mimes', __NAMESPACE__ . '\\allow_cast_upload_mime', 10, 2 );
add_filter( 'wp_check_filetype_and_ext', __NAMESPACE__ . '\\check_cast_filetype', 10, 5 );
function load_scripts() add_filter( 'wp_handle_upload_prefilter', __NAMESPACE__ . '\\validate_cast_upload' );
{ add_filter( 'wp_handle_sideload_prefilter', __NAMESPACE__ . '\\validate_cast_upload' );
if (!is_single()) {
return;
}
global $post;
if (has_shortcode($post->post_content, ASCIIPLAYER_TAG)) {
wp_enqueue_script(
'asciiplayer-adapter-js',
get_adapter_url() . '/dist/bundle.js',
array(),
PLUGIN_VERSION
);
wp_enqueue_style(
'asciiplayer-adapter-css',
get_adapter_url() . '/dist/styles.css',
array(),
PLUGIN_VERSION
);
}
}
add_action('wp_enqueue_scripts', 'load_scripts');
function get_adapter_url(): string
{
$use_local_resources = boolval(get_option(AP_OPTION_USE_LOCAL_RESOURCES, true));
$version = PLUGIN_VERSION;
if ($use_local_resources) {
return plugin_dir_url(__FILE__) . '/asciiplayer';
} else {
return "https://cdn.jsdelivr.net/npm/wp-asciiplayer-adapter@$version";
}
}
-2
View File
@@ -1,2 +0,0 @@
dist/
node_modules/
-16
View File
@@ -1,16 +0,0 @@
# wp-asciiplayer-adapter
This library needs to be used with the WordPress Ascicast Player plugin.
## How to work
The Asciicast Player plugin will generate a div element containing the parameters required for asciicast playback for the asciiplayer short code in the post:
```html
<div class="asciiplayer-container"
data-ap-src="https://asciinema.org/a/28307.cast"
data-ap-opts="%7B%22fit%22%3A%22width%22%2C%22preload%22%3Atrue%7D">
</div>
```
Then, the adapter will search for these div elements and use [asciinema-player](https://www.npmjs.com/package/asciinema-player) to create an Asciicast player within the div elements.
-1782
View File
File diff suppressed because it is too large Load Diff
-27
View File
@@ -1,27 +0,0 @@
{
"name": "wp-asciiplayer-adapter",
"version": "1.0.1",
"description": "asciinema-player for wordpress.",
"main": "dist/bundle.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"bundle": "npx webpack"
},
"keywords": [
"wordpress",
"asciicast",
"asciicast-player"
],
"author": "LamGC",
"license": "GPL-3.0-only",
"dependencies": {
"asciinema-player": "^3.4.0"
},
"devDependencies": {
"css-loader": "^6.8.1",
"mini-css-extract-plugin": "^2.7.6",
"webpack": "^5.85.1",
"webpack-cli": "^5.1.3"
}
}
-52
View File
@@ -1,52 +0,0 @@
import * as AsciinemaPlayer from "asciinema-player";
import "asciinema-player/dist/bundle/asciinema-player.css";
import "../styles/default-player.css";
const defaultOpts = {
preload: true,
fit: "width"
}
document.addEventListener('DOMContentLoaded', () => {
const containers = document.getElementsByClassName("asciiplayer-container");
for (const container of containers) {
const castSource = container.dataset["apSrc"];
const containerStyle = container.dataset["apStyle"];
if (!castSource) {
console.warn(`asciiplayer: container ${container.id} has no data-ap-src attribute, skip.`);
continue;
}
let encodedOptions = container.dataset["apOpts"];
let options = defaultOpts;
if (encodedOptions) {
try {
options = mergeOptions(defaultOpts, JSON.parse(decodeURIComponent(encodedOptions)));
} catch (err) {
console.error("asciiplayer: failed to parse data-ap-options, skip.", err);
continue;
}
}
if (containerStyle) {
container.setAttribute("style", containerStyle);
delete container.dataset["apStyle"];
}
// noinspection JSCheckFunctionSignatures - create 中会判断是否为三个函数.
AsciinemaPlayer.create(castSource, container, options);
}
});
/**
*
* @param defaults {Object}
* @param opts {Object}
*/
function mergeOptions(defaults, opts) {
let result = {};
for (const key of Object.keys(defaults)) {
result[key] = defaults[key];
}
for (const key of Object.keys(opts)) {
result[key] = opts[key];
}
return result;
}
-3
View File
@@ -1,3 +0,0 @@
.asciiplayer-container {
margin: 0 auto;
}
-24
View File
@@ -1,24 +0,0 @@
import path from 'path';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
export default {
entry: './src/index.js',
mode: "production",
output: {
path: path.resolve('./dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'styles.css'
})
]
};
+8
View File
@@ -0,0 +1,8 @@
{
"presets": ["@wordpress/babel-preset-default"],
"plugins": [["@babel/plugin-transform-react-jsx", {
"runtime": "classic",
"pragma": "wp.element.createElement",
"pragmaFrag": "wp.element.Fragment"
}]]
}
+41
View File
@@ -0,0 +1,41 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "lamgc/asciiplayer",
"version": "1.1.0-dev",
"title": "Asciicast Player",
"category": "media",
"icon": "editor-code",
"description": "Embed and preview a terminal recording with the locally bundled asciinema player.",
"keywords": ["asciinema", "terminal", "recording"],
"textdomain": "wp-asciiplayer",
"attributes": {
"source": { "type": "string", "default": "" },
"theme": { "type": "string", "default": "asciinema" },
"speed": { "type": "number", "default": 1 },
"loop": { "type": "boolean", "default": false },
"controls": { "type": "string", "default": "auto", "enum": ["auto", "always", "never"] },
"fit": { "type": "string", "default": "width", "enum": ["width", "height", "both", "none"] },
"startAt": { "type": "number", "default": 0 },
"idleTimeLimit": { "type": "number", "default": 0 },
"autoPlay": { "type": "boolean", "default": false },
"preload": { "type": "boolean", "default": true },
"width": { "type": "string", "default": "100%" },
"displayAlign": { "type": "string", "default": "center", "enum": ["left", "center", "right"] },
"caption": { "type": "string", "default": "" },
"isExample": { "type": "boolean", "default": false },
"legacyStyle": { "type": "string", "default": "" },
"cols": { "type": "number" },
"rows": { "type": "number" },
"terminalFontFamily": { "type": "string" },
"terminalFontSize": { "type": "string" },
"terminalLineHeight": { "type": "number" },
"poster": { "type": "string" }
},
"example": { "attributes": { "isExample": true } },
"supports": { "html": false, "align": ["wide", "full"] },
"editorScript": "lamgc-asciiplayer-editor",
"viewScript": "lamgc-asciiplayer-view",
"editorStyle": "lamgc-asciiplayer-editor-style",
"style": "lamgc-asciiplayer-style"
}
+96
View File
@@ -0,0 +1,96 @@
# Dependency security review
Reviewed 2026-10-14 against the main-branch lockfile and fresh npm audit. Baseline: **44 affected package records (2 critical, 19 high, 20 moderate, 3 low), representing 15 distinct advisories**. The package-record count includes vulnerable packages and their affected parents; it is not 44 distinct security defects. All mapped paths originate in development dependencies. The final production-only root-lock audit reports zero findings; the separately vendored browser player is assessed in [player-bundle-review.md](player-bundle-review.md).
## Implemented narrow changes
Retain the current WordPress parent packages: npm registry reports `@wordpress/[email protected]` and `@wordpress/[email protected]` as current latest. This change uses scoped overrides:
```json
{
"copy-webpack-plugin": { "serialize-javascript": "7.0.5" },
"markdownlint-cli": { "js-yaml": "5.4.3", "smol-toml": "1.9.1" },
"simple-git": { "@simple-git/argv-parser": "2.0.1" }
}
```
- `serialize-javascript`: the current `[email protected]` calls the CommonJS serializer for cache keys. Version 7 retains that callable CommonJS API. Its major-version requirement is Node >=20, already satisfied by this project. Isolated serialization smoke tests passed. Upgrading the entire plugin to 14 would be a larger, unnecessary compatibility change. [v7 release](https://github.com/yahoo/serialize-javascript/releases/tag/v7.0.0)
- `js-yaml`: 5.4.1 is the minimum patched version; 5.4.3 is the latest verified patch. Scope it to `markdownlint-cli`; that package pins `~5.2.1`. Do not override js-yaml globally: wp-env still calls `yaml.safeLoad`, which is unavailable in modern majors. The separate wp-env -> js-yaml 3 -> argparse 1 -> sprintf-js path remains.
- `smol-toml`: 1.9.0 is the minimum patched version; 1.9.1 is the latest verified patch. Scope it to markdownlint-cli, which pins `~1.7.0`. The CommonJS parse API works and the null-prototype result matches the installed older version.
- `qs`: 6.16.0 fixes both findings. **Prefer the in-range Express 4.22.2 -> 4.22.3 update**, because official metadata confirms 4.22.3 pins qs `~6.16.0`. If lockfile regeneration cannot resolve that parent update, a scoped `express -> qs: 6.16.0` override is a fallback. Avoid a disruptive Express 5 migration. The existing body-parser path already has 6.16.0.
- `@simple-git/argv-parser`: the scoped 2.0.1 override is a partial mitigation only, with targeted no-execution tests. Preserve and document remaining simple-git alerts; details below.
These recommendations were based on official npm metadata, published tarballs, source inspection, and small isolated API smoke tests. Local build, 41 JS tests and packaging pass on Node 24.18.0. CI covers PHP 7.4/8.3 and real WordPress 6.3/PHP 7.4 and latest/PHP 8.2 integration.
## Critical simple-git findings: migration blocker
Path: `@wordpress/[email protected] -> [email protected] -> @simple-git/[email protected]`.
**Do not directly override simple-git to v4.** v4 removes the callable CommonJS default export and requires `const { simpleGit } = require('simple-git')`. wp-env currently uses `const SimpleGit = require('simple-git')` and then calls it in both `lib/download-sources.js` and `lib/runtime/docker/download-wp-phpunit.js`. A direct v4 override would fail during Git source/PHPUnit downloads. [Official v4 breaking changes](https://github.com/steveukx/git-js/releases/tag/[email protected])
The fully patched latest combination is simple-git **4.0.2**, which pins argv-parser **2.0.1**. Note that simple-git 4.0.1 pins parser 2.0.0, so it does not by itself clear the VISUAL finding.
A scoped parser-only override to 2.0.1 is included as a **partial mitigation**, with regression tests of the CommonJS API and rejected unsafe inputs. The `vulnerabilityCheck(tokens, env)` signature is unchanged, and isolated simple-git 3.36.0 with parser 2.0.1 passed read-only `checkIsRepo('root')`, `raw('rev-parse', '--show-toplevel')`, and `status()` checks. Parser checks rejected VISUAL, trailer command configuration, and include.path. However, `--receive-p` still produced no finding in that parser-only combination, and version-based simple-git advisories remain. This is not a complete fix and has not been validated through all wp-env Docker/download flows. It is reasonable to include the scoped parser override with the focused regressions while explicitly retaining the residual alerts; a full fix still needs a reviewed wp-env migration.
The examined wp-env call sites use clone/fetch/checkout/reset and fixed sparse-checkout commands; no commit, rebase, interpret-trailers, push, or explicit `.env()` calls were observed in these files. This reduces reachability of the reported flows for ordinary trusted wp-env use, but does not establish that the vulnerable dependency is harmless. Keep development configuration, Git arguments, environment values and source URLs trusted; do not run these tools on attacker-controlled configuration with privileged credentials.
## Advisory matrix
Ranges below are the audit's affected ranges and GitHub Advisory Database's patched versions. Registry availability was checked on the review date.
| Package / baseline | Advisory | Affected range | First patched version | Decision |
|---|---|---|---|---|
| @simple-git/argv-parser 1.1.1 | [VISUAL editor bypass](https://github.com/advisories/GHSA-v5rq-49vh-5v5c) | <2.0.1 | 2.0.1 | Parser 2.0.1 removes this finding; simple-git mitigation remains incomplete overall |
| simple-git 3.36.0 | [Trailer command configuration](https://github.com/advisories/GHSA-x6jw-m9v5-85vh) | >=3.15.0 <4.0.1 | 4.0.1 | v4 is not drop-in for wp-env |
| simple-git 3.36.0 | [Git configuration includes](https://github.com/advisories/GHSA-g4wm-2vf7-vfgr) | <=3.36.0 | 4.0.0 | Same migration blocker |
| simple-git 3.36.0 | [Long-option abbreviation bypass](https://github.com/advisories/GHSA-858h-whjf-mvg5) | <=3.36.0 | 4.0.0 | Parser-only override does not fix this path |
| serialize-javascript 6.0.2 | [RegExp/Date code injection](https://github.com/advisories/GHSA-5c6j-r48x-rmvq) | <=7.0.2 | 7.0.3 | Scoped 7.0.5 clears both findings |
| serialize-javascript 6.0.2 | [Array-like object CPU exhaustion](https://github.com/advisories/GHSA-qj8w-gfj5-8c6v) | >=5.0.0 <7.0.5 | 7.0.5 | Scoped 7.0.5 |
| braces 3.0.3 | [Deep nesting stack exhaustion](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm) | <=3.0.3 | None | Latest published version still affected; trusted build globs only |
| js-yaml 5.2.3 | [Empty merge source CPU exhaustion](https://github.com/advisories/GHSA-r3ph-w7gj-g6xm) | >=5.0.0 <=5.4.0 | 5.4.1 | Scoped 5.4.3 under markdownlint-cli |
| smol-toml 1.7.2 | [Quadratic key parsing](https://github.com/advisories/GHSA-r4xh-jqrq-34v2) | <=1.8.0 | 1.9.0 | Scoped 1.9.1 |
| sprintf-js 1.0.3 | [Unbounded precision DoS](https://github.com/advisories/GHSA-hp3w-g68c-fv3c) | <=1.1.3 | None | Latest published version still affected; wp-env parent migration needed |
| qs 6.15.3 | [Array-limit bypass](https://github.com/advisories/GHSA-x5fp-wj9c-mxmx) | >=6.14.2 <=6.15.3 | 6.16.0 | Express 4.22.3 / qs 6.16.0 |
| qs 6.15.3 | [Attacker-controlled isBuffer](https://github.com/advisories/GHSA-4mjr-xmp4-gh2g) | >=2.2.5 <6.16.0 | 6.16.0 | Scoped 6.16.0 |
| postcss-selector-parser 6.1.4 | [Flat selector CPU exhaustion](https://github.com/advisories/GHSA-rj75-hqrm-r3gf) | <7.1.6 | 7.1.6 | Requires v6 -> v7 range override or parent migration; defer pending CSS-specific regression tests |
| uuid 8.3.2 | [Missing output buffer checks](https://github.com/advisories/GHSA-w5hq-g745-h8pq) | <11.1.1 (installed line) | 11.1.1 | Cross-major candidate; sockjs only calls v4(), not the affected v3/v5/v6 APIs |
| katex 0.16.47 | [Prototype pollution trust bypass](https://github.com/advisories/GHSA-238p-pmpm-9mq7) | >=0.11.0 <0.18.2 | 0.18.2 | 0.x minor-range migration; defer pending markdown math regression validation |
The KaTeX advisory range is from the fresh npm audit. Its GitHub advisory page could not be retrieved during this pass; registry 0.18.2 was downloaded and its rendering API smoke-tested. The fix boundary is inferred from the audit range rather than independently confirmed from that advisory page.
## Paths behind remaining package records
- braces: scripts -> fast-glob -> micromatch -> braces; also transitively affects copy-webpack-plugin, stylelint-family tooling, webpack-dev-server's chokidar and http-proxy-middleware paths. No patched braces release is available, despite some propagated `fixAvailable: true` flags in npm audit.
- postcss-selector-parser: scripts -> cssnano 6.1.2 -> cssnano-preset-default 6.1.2 -> postcss-calc 9.0.1, postcss-merge-rules 6.1.1, postcss-minify-selectors 6.0.4, postcss-unique-selectors 6.0.4, or postcss-merge-longhand 6.0.5 -> stylehacks 6.1.1. Each currently resolves a nested parser 6.1.4. The hoisted parser 7.1.6 is already patched. v7's notable breaking behavior is safe insertion during iteration; avoid a blind global replacement. The advisory explicitly excludes ordinary build-time parsing of trusted source CSS from exposed request-path scenarios. [v7 release](https://github.com/postcss/postcss-selector-parser/releases/tag/v7.0.0)
- sprintf-js: env -> js-yaml 3.15.2 -> argparse 1.0.10 -> sprintf-js 1.0.3. Updating sprintf-js to its latest 1.1.3 does not fix the advisory. Updating js-yaml globally breaks wp-env's safeLoad call.
- uuid: scripts -> webpack-dev-server 5.2.6 -> sockjs 0.3.24 -> uuid 8.3.2. Source inspection finds `require('uuid').v4` and `uuidv4()` only. A scoped uuid11.1.1 override retains CommonJS and passed v4()/validate() smoke testing, but it remains outside sockjs's supported ^8 range. Do not choose uuid12+ blindly because of later module-format changes.
- KaTeX: scripts -> markdownlint-cli 0.49.1 -> markdownlint 0.41.1 -> micromark-extension-math 3.1.0 -> katex 0.16.47. Minimum nonaffected release 0.18.2 exposes renderToString and passed a basic rendering smoke test, but is outside micromark's ^0.16 range.
- qs (recommended fix): env -> @wp-playground/cli 3.1.57 -> express 4.22.2 -> qs 6.15.3; shared Express is also used by webpack-dev-server.
- serialize-javascript (recommended fix): scripts -> copy-webpack-plugin 10.2.4 -> serialize-javascript 6.0.2.
## Engine consistency
The existing Playground/PHP-WASM 3.1.57 tree requires Node >=24.18.0 and npm >=11.16.0. `@wordpress/[email protected]` accepts Node `^22.22.2 || ^24.15.0 || >=26.0.0`, so the intersection is **`^24.18.0 || >=26.0.0`**, not plain >=24.18.0 (which would misleadingly include Node 25). Use npm >=11.16.0 and test the supported minimum in CI. The build and tests were rerun on Node 24.18.0 with npm 11.19.0. CI pins these versions. Node 26 is admitted by dependency engine declarations but has not been separately exercised here.
## Verification checklist
1. Regenerate the lockfile without force and inspect that only intended subtree changes occur.
2. Run `npm ci`, build, JS tests, PHP tests where supported, and release packaging.
3. Validate markdownlint YAML and TOML configuration loading after its minor-range overrides.
4. Run final `npm audit --json` and `npm audit --omit=dev --json`; describe residuals honestly, including the critical simple-git findings.
5. Track wp-env's simple-git v4 migration and braces/sprintf-js upstream releases. Do not suppress remaining advisories merely to make the report green.
## Final audit snapshot
After these changes, npm 11.19.0 reports **39 affected package records**
(1 critical, 20 high, 14 moderate, 4 low), representing **8 distinct advisories**,
versus 15 distinct advisories in the initial snapshot. Counts can change as the
registry advisory database changes; do not equate affected parents with unique flaws.
The remaining advisory packages are braces, KaTeX, postcss-selector-parser,
simple-git (three advisories), sprintf-js and uuid. No advisory is suppressed.
`npm audit --omit=dev --json` reports zero findings for the root production lock.
This does not certify arbitrary bundled code or establish a complete security audit.
Do not run development servers or wp-env against untrusted configurations or
source URLs, or expose development services publicly. A full simple-git fix
needs a compatible wp-env migration; the parser override is not a complete fix.
@@ -0,0 +1,55 @@
# Resource-budget experiment results
Experiment only. No production implementation, merge, release or deployment.
## Verified run
[GitHub Actions run 38667731485](https://github.com/LamGC/wp-asciiplayer/actions/runs/38667731485) passed all three jobs on tested commit `fcaf9be8103214d60485e761858f269d13f55cd7`, based on main `ffff9704e5bca7a07d5f57a2f832475ac102d01c`.
Runtime versions: Node 24.18.0, Playwright 1.64.0, Chromium 156.0.8078.4, asciinema-player 3.17.0; native PHP 7.4.33 and 8.3.35 in official Docker images. The raw PHP artifacts include the resolved image digests. The player bundle SHA-256 matched `a13c37632e1b5c49fe9128417b9319a9b5bc64cb457dd5ae52cbba8a3aceb880`.
## Actual browser evidence
All 31 controlled cases passed, including baseline/prototype v1/v2/v3 playback and seek, top-level and same-origin iframe, marker boundaries, and safe rejection of late resize and excessive terminal cell counts. No dangerous-dimension baseline was rendered.
| Case | Baseline | Prototype |
|---|---:|---:|
| 1,000 markers, added DOM elements | 3,049 | 3,049 (accepted) |
| 1,001 markers, added DOM elements | 3,052 | 0 (rejected before player creation) |
| 3,000 markers, added DOM elements | 9,049 | 0 (rejected before player creation) |
| 3,000 markers, initialization / seek | 738.2 ms / 413.2 ms | Rejected in 10.6 ms |
Zero-marker baseline added 49 elements: the measured differences agree with three additional elements per marker. Baseline 3,000-marker sampled JS heap delta was 4,110,979 bytes; this is not total browser memory or process RSS. Timings are single-run diagnostics on one CI runner, not statistical or mobile performance claims. The protected rejection path made zero player creation calls.
## Native PHP evidence
Each measured sample runs in a fresh CLI process with a 128 MiB PHP memory limit and a 20-second watchdog. Values below are PHP tracked peak allocation, not OS RSS.
| Input | PHP | Baseline peak | Gated peak |
|---|---|---:|---:|
| 260,000 empty metadata objects, 780,070 bytes | 7.4.33 | 22,122,216 B | 1,255,960 B |
| Same | 8.3.35 | 17,927,440 B | 1,247,624 B |
| 800,000 metadata scalars, 1,600,070 bytes | 7.4.33 | 35,618,240 B | 2,075,136 B |
| Same | 8.3.35 | 18,840,552 B | 2,066,800 B |
Both rejected shapes stop before json_decode, reducing measured peak allocation by approximately 89–94%. Both versions passed all 229 source-only regression assertions with and without the gate, plus 13 scanner assertions. The earlier local count of 233 included four generated-asset-manifest checks; this source-only CI intentionally did not fabricate build manifests.
Normal v1, escaped strings and 100,000 simple frames remain accepted. That last case still peaks at 43,763,464 B on PHP 7.4 and 25,666,160 B on PHP 8.3. Preflight adds CPU work: in these native samples the normal 100k-frame check went from 25.4 to 60.7 ms / 38.9 to 76.5 ms, respectively.
## Confirmed compatibility and remaining work
The experiment deliberately exposes two compatibility gaps: the original player accepts zero dimensions as defaults and skips blank JSONL lines, while this prototype rejects both. Production integration should preserve safe accepted forms rather than copy the prototype unchanged. Compact single-line v1 and other upstream-tolerated inputs need explicit compatibility decisions.
Candidate marker limit 1,000, adapter cell budget 40,000, parser/byte/event limits and PHP token budgets are experimental. They are not final recommendations. Per-axis bounds alone still allow an excessive cell product. The browser cell test uses an explicit pre-player adapter seam. Local stream tests established early byte/line rejection; this CI browser harness does not independently reproduce every streaming/network edge case.
A formal implementation still needs shared upload/playback policy, cancellation on URL changes/disposal, real WordPress editor integration, localization, CORS/credential checks, aggregate multiple-player budgets and low-memory profiling. Same-origin synthetic iframe success is not a full WordPress integration pass. No Cloud finding state was changed.
## Evidence artifacts
Artifacts are retained for seven days by this experiment workflow:
- [Browser raw results](https://github.com/LamGC/wp-asciiplayer/actions/runs/38667731485/artifacts/11942427047)
- [Native PHP 7.4 raw results and logs](https://github.com/LamGC/wp-asciiplayer/actions/runs/38667731485/artifacts/11943311264)
- [Native PHP 8.3 raw results and logs](https://github.com/LamGC/wp-asciiplayer/actions/runs/38667731485/artifacts/11943136266)
Conclusion: the tested resource gates demonstrably prevent the intended allocation/rendering paths while preserving the ordinary fixtures. This supports proceeding to a carefully integrated fix after compatibility decisions; it does not establish that the production plugin is already fixed.
+62
View File
@@ -0,0 +1,62 @@
# Prebuilt player dependency reachability review
Reviewed 2026-10-14 for `[email protected]`. This is a static review of
specific published bytes, not an independent rebuild or a full security audit.
`scripts/vendor.mjs` copies the npm package's prebuilt browser bundle unchanged.
The root lockfile therefore does not describe all components used to build it.
The upstream dependency inventory is deliberately conservative: it includes
Seroval 1.5.0 through Solid 1.9.6, including server-only dependency paths.
## Verified artifact
The official npm package integrity is recorded in package-lock.json.
- Minified bundle SHA-256: `a13c37632e1b5c49fe9128417b9319a9b5bc64cb457dd5ae52cbba8a3aceb880`
- Readable bundle SHA-256: `4d63cfb88859f158d1eef5d8a5550861abcb7ec195fb5d684f35f6446a29fe11`
The minified hash also matches THIRD-PARTY-NOTICES.md and the installed package.
## Import and artifact evidence
1. [Player view.js](https://github.com/asciinema/asciinema-player/blob/v3.17.0/src/view.js)
imports `render` from `solid-js/web`.
2. Solid 1.9.6's package exports select `web/dist/web.js` for the browser/default
import. Its only external import is `solid-js`; the client `dist/solid.js`
has no imports. Neither imports Seroval.
3. Seroval is imported by the separate `web/dist/server.js` SSR renderer,
not the browser renderer.
4. The [Rollup configuration](https://github.com/asciinema/asciinema-player/blob/v3.17.0/rollup.config.mjs)
creates both readable and minified IIFEs from the same intermediate ESM bundle.
The inspected readable IIFE contains the client renderer and does not contain
Seroval deserialization implementations.
5. Both bundles lack `Seroval`, `fromJSON`, `fromCrossJSON`, `deserialize`,
`__SEROVAL_STREAM__`, and distinctive Seroval error/typed-array registry
signatures. Name searches alone are not proof; they corroborate the import trace.
6. Recording/live input paths use native `JSON.parse`/`response.json`, not
Seroval decoding.
## Advisory-specific conclusion
No reachable affected Seroval decoder was found in these browser bundle bytes:
- [GHSA-mv8w-475r-vwqw](https://github.com/advisories/GHSA-mv8w-475r-vwqw):
affected <=1.5.2, fixed 1.5.3; requires `fromJSON` Promise-control deserialization.
- [GHSA-p6vx-979v-rg4c](https://github.com/advisories/GHSA-p6vx-979v-rg4c):
affected >=0.12.0, <=1.6.0, fixed 1.6.2; requires `fromJSON` with plugin-produced
callables and Promise assimilation.
- [GHSA-jp82-f5mq-hwhp](https://github.com/advisories/GHSA-jp82-f5mq-hwhp):
affected <=1.6.2, fixed 1.6.3; requires Seroval typed-array JSON deserialization.
Seroval 1.5.0 is inside these version ranges, but the necessary decoder is absent
from this browser dependency path. Do not label the player vulnerable solely from
that inventory, or claim the entire plugin safe from this limited review.
Re-review after any player artifact or build-path change.
## Reproduction
Fetch official npm tarballs into separate directories using `npm pack --ignore-scripts`
for `[email protected]`, `[email protected]`, and `[email protected]`.
Verify both player hashes with `sha256sum`, inspect Solid's package exports and
client/server imports, and compare the readable bundle implementation against
those modules. Search both bundles for the decoder names/signatures above.
+44
View File
@@ -0,0 +1,44 @@
# Isolated resource-budget experiment, 2026-10-15
This is experimental evidence, not a production patch or security clearance. No repository source was changed or published; no CI, production system, or external hostile endpoint was exercised.
## Environment and boundaries
Node 24.19.0. Installed player 3.17.0 bundle SHA-256 a13c37632e1b5c49fe9128417b9319a9b5bc64cb457dd5ae52cbba8a3aceb880. PHP-WASM 7.4.33 / 8.3.33 via @php-wasm/node 3.1.57. Browser attempted: Chromium 154.0.8037.57, Playwright 1.64.0; blocked before page creation by socket EPERM. No DOM/playback/seek measurement succeeded. No alternate browser bypass attempted.
Synthetic tests were process-time-limited and Node heaps limited. PHP memory limit 128 MiB, with separate subprocess monitoring. Inputs remain bounded; no intentional host resource exhaustion.
## Remote loader prototype
17 baseline loader cases, 8 edge cases, a stalled-reader test, and actual upstream parser compatibility tests pass. Existing hello/replacement/resize/v1-pretty/v3-comments fixtures yield identical events, durations and dimensions through the installed parser and preparation functions. Only the export list in an isolated copy of the upstream core module was changed to expose those functions; this does not execute DOM or terminal rendering.
A controlled 2,220,037-byte stream baseline fully buffers and parses 20,000 events. With an intentionally small 64-KiB test cap, protected loader cancels after 65,638 bytes and never returns player input. Recorded Node heap delta: baseline 7,166,144 B versus protected 1,796,216 B; 48.15 ms versus 10.30 ms in that single sample. Heap/timing numbers are illustrative, not stable production benchmarks.
A 300,048-byte event line is rejected before parsing it. Initial dimensions and late resize dimensions above the candidate per-axis limit are rejected. UTF-8 split into single bytes and CRLF work; invalid UTF-8 is rejected. Unknown event codes remain supported. A normal 100,000-output-event cast is accepted. A stalled stream using a 25-ms experimental read deadline was canceled at 30.5 ms.
## Marker experiment
Shared preflight accepts 0/100/500/1,000 markers and rejects 1,001/3,000 at marker 1,001. With the actual installed upstream parser/recording preparation, a 3,000-marker baseline retains 3,000 markers; protected loader rejects before calling that parser (zero calls). This validates the pre-player gate. The source-derived three-span-per-marker relationship has NOT been empirically measured in a running browser here.
## PHP v1 experiment
PHP tracked peak allocation (not total process RSS):
- 260k empty metadata objects, 780,070 bytes: PHP 7.4 16,955,544 -> 1,232,192 B; PHP 8.3 12,761,472 -> 1,224,552 B.
- 800k metadata scalars, 1,600,070 bytes: PHP 7.4 35,656,088 -> 2,051,392 B; PHP 8.3 18,879,104 -> 2,043,752 B.
- Rejection before json_decode at offsets 300,105 and 800,049; approximately 89–94% peak reduction.
- Existing PHP regression suite passes all 233 assertions baseline and gated on BOTH versions. Thirteen extra scanner assertions also pass.
- Normal v1, large escaped strings, and 100,000 simple frames remain accepted. The last still uses ~43.4 MB on PHP 7.4 / ~25.3 MB on 8.3.
- Scanning increases CPU time, up to ~455 ms in one WASM sample.
## Decisions and unverified work before formal fix
Candidates are experiments, not approved defaults: 32 MiB overall, 2 MiB v1, 256 KiB JSONL line, 100,000 events, 1,000 markers, depth 16, dimensions <=1,000 per axis. PHP gate separately experiments with 100,016 containers / 400,000 scalar-and-key tokens.
Upstream accepts zero dimensions as defaults and skips blank/non-event lines; the prototype follows stricter existing upload behavior. Applying this remotely changes compatibility and must be deliberately resolved. Per-axis bounds still admit one million terminal cells; a total-cell/work budget requires profiling. Current JS v1 prototype stores line strings until bounded whole-document preflight; production implementation should avoid large per-line overhead. A single oversized stream chunk may already be allocated by the platform before code can reject it. Default deadlines, cancellation on source changes/disposal, credential/CORS behavior, localization, multiple-player aggregate memory and real WordPress/browser playback need integration validation. Native PHP deployment memory is not established by WASM results.
Recommendation: the mitigation mechanism is empirically effective for the tested PHP and parser-input paths. Do not call all three findings fixed or choose final thresholds yet. Resolve compatibility and obtain browser/native integration evidence before publishing a formal patch.
## Scope
These are prior local measurements. CI artifacts provide separate native PHP and browser results. Experimental files are not loaded by the plugin.
+20
View File
@@ -0,0 +1,20 @@
# Isolated recording budget experiment
This branch adds experiments only. The plugin never loads these files. No formal fix, release, deployment or security finding closure is implied.
`resource-budget-experiment.yml` runs native PHP 7.4/8.3 and real Chromium with the pinned player 3.17.0. Results are retained as seven-day Actions artifacts. Browser payload delivery permits only controlled loopback fixtures; PHP runtime has networking disabled. Setup downloads official runtimes and locked dependencies.
Run from checkout root:
- `npm ci --ignore-scripts`
- `npx --no-install playwright install --with-deps chromium`
- `node experiment/browser.cjs`
- `php -d memory_limit=128M experiment/php/run.php "$PWD" /tmp/cast-results`
The browser harness records actual DOM marker counts, playback/seek, same-origin iframe compatibility, diagnostic timings and sampled JS heap values. Heap samples are not total process RSS; timings are one run per case, not statistical performance claims. Large terminal dimensions run only through the rejection path. Marker cap 1,000 and total-cell adapter cap 40,000 are experimental candidates. The separate loader also has an optional cell budget; this harness explicitly identifies its adapter seam.
Compatibility differences are measured explicitly: current player accepts zero dimensions as defaults and ignores blank JSONL lines; the experimental loader follows stricter upload rules. These differences need a decision before any formal implementation. Compact single-line v1 remains rejected by this prototype, as in the existing upload path. The loader's read deadline does not interrupt synchronous parsing or guarantee an overall CPU limit; process/job watchdogs bound this experiment.
Native PHP fixtures are generated in temporary storage and capped below 2 MiB. Each measurement uses a fresh process with a 128 MiB PHP memory limit and 20-second watchdog. The original regression suite runs from a temporary copy with and without the gate. PHP tracked peak allocation is reported separately from OS memory. Permitting 100,000 normal frames still consumes meaningful memory.
Do not treat passing measurements as production readiness: actual WordPress integration, cross-origin/CORS behavior, multiple-player aggregate budgets, low-memory/mobile profiling and final compatibility/default choices remain separate work.
+50
View File
@@ -0,0 +1,50 @@
// Isolated experimental prototype; not production code.
export const defaults = { bytes: 32*1024*1024, line: 256*1024, v1Bytes: 2*1024*1024, events:100000, markers:1000, depth:16, tokens:500000, lineTokens:20000, dimension:1000 };
export function complexity(text, {depth,tokens}) {
let quoted=false, escaped=false, nesting=0, count=0, primitive=false;
for(let i=0;i<text.length;i++) {
const c=text[i];
if(quoted) { if(escaped) escaped=false; else if(c==='\\') escaped=true; else if(c==='"') quoted=false; continue; }
if(c==='"') { quoted=true; primitive=false; if(++count>tokens) throw Error('complexity'); }
else if(c==='['||c==='{') { primitive=false; if(++nesting>depth) throw Error('depth'); if(++count>tokens) throw Error('complexity'); }
else if(c===']'||c==='}') { primitive=false; if(--nesting<0) throw Error('invalid'); }
else if(c===','||c===':'||/\s/.test(c)) primitive=false;
else if(!primitive) { primitive=true; if(++count>tokens) throw Error('complexity'); }
}
if(quoted||nesting!==0) throw Error('invalid');
return count;
}
export async function loadBounded(response, limits={}, metrics={}) {
const l={...defaults,...limits}; Object.assign(metrics,{bytes:0,lines:0,events:0,markers:0,parsed:0,canceled:false});
if(!response.ok||!response.body?.getReader) throw Error('response');
const reader=response.body.getReader(); const decoder=new TextDecoder('utf-8',{fatal:true});
const deadline=performance.now()+(l.totalTimeoutMs??30000);
async function read(){let timer;try{return await Promise.race([reader.read(),new Promise((_,reject)=>{timer=setTimeout(()=>reject(Error('timeout')),Math.max(0,Math.min(l.readTimeoutMs??5000,deadline-performance.now())));})]);}finally{clearTimeout(timer);}}
let pending='', lineBytes=0, first=true, mode, header, events=[], v1=[],time=0;
const finite=x=>typeof x==='number'&&Number.isFinite(x)&&x>=0&&Number.isFinite(x*1000);
const dim=x=>Number.isInteger(x)&&x>0&&x<=l.dimension;
const parse=s=>{complexity(s,{depth:l.depth,tokens:l.lineTokens});metrics.parsed++; return JSON.parse(s);};
function checkHeader(h){ if(!h||![1,2,3].includes(h.version))throw Error('header'); const t=h.version===3?h.term:h;if(!t||!dim(h.version===3?t.cols:t.width)||!dim(h.version===3?t.rows:t.height))throw Error('dimensions'); if(l.cells && (h.version===3?t.cols:t.width)*(h.version===3?t.rows:t.height)>l.cells)throw Error('cells'); for(const k of ['duration','idle_time_limit'])if(k in h&&!finite(h[k]))throw Error('time'); }
function line(s){
metrics.lines++;
if(first){first=false;try{header=parse(s);}catch{mode='v1';v1.push(s+'\n');return;}checkHeader(header);if(header.version===1)throw Error('compact-v1');mode='jsonl';return;}
if(mode==='v1'){v1.push(s+'\n');return;}
if(++metrics.events>l.events)throw Error('events');
if(header.version===3&&s[0]==='#')return;
if(s[0]!=='[')throw Error('event'); const e=parse(s);
if(!Array.isArray(e)||e.length!==3||!finite(e[0])||typeof e[1]!=='string'||!e[1]||typeof e[2]!=='string')throw Error('event');
if(header.version===2&&e[0]<time)throw Error('time');time=header.version===2?e[0]:time+e[0];if(!finite(time))throw Error('time');
if(e[1]==='r'){const m=/^([1-9][0-9]{0,3})x([1-9][0-9]{0,3})$/.exec(e[2]);if(!m||!dim(+m[1])||!dim(+m[2]))throw Error('dimensions');if(l.cells&&(+m[1])*(+m[2])>l.cells)throw Error('cells');}
if(e[1]==='m'&&++metrics.markers>l.markers)throw Error('markers'); events.push(e);
}
try {
while(true){const {value,done}=await read();if(done)break;
metrics.bytes+=value.byteLength;if(metrics.bytes>l.bytes||(mode==='v1'&&metrics.bytes>l.v1Bytes))throw Error('bytes');
let start=0;
for(let i=0;i<=value.length;i++)if(i===value.length||value[i]===10){const part=value.subarray(start,i);lineBytes+=part.length;if(mode!=='v1'&&lineBytes>l.line)throw Error('line');pending+=decoder.decode(part,{stream:true});if(i<value.length){line(pending);pending='';lineBytes=0;start=i+1;}}
}
pending+=decoder.decode();if(pending)line(pending);
if(mode==='v1'){if(metrics.bytes>l.v1Bytes)throw Error('bytes');const text=v1.join('');complexity(text,{depth:l.depth,tokens:l.tokens});metrics.parsed++;const h=JSON.parse(text);checkHeader(h);if(h.version!==1||!Array.isArray(h.stdout)||h.stdout.length>l.events)throw Error('v1');for(const e of h.stdout){if(!Array.isArray(e)||e.length!==2||!finite(e[0])||typeof e[1]!=='string')throw Error('v1');time+=e[0];if(!finite(time))throw Error('time');}metrics.events=h.stdout.length;return h;}
if(!header||!events.length)throw Error('empty');return [header,...events];
}catch(e){metrics.canceled=true;await reader.cancel(e.message).catch(()=>{});throw e;}finally{reader.releaseLock();}
}
+131
View File
@@ -0,0 +1,131 @@
'use strict';
// Isolated CI experiment. No app source changes. Run from repository root.
const fs = require('node:fs');
const path = require('node:path');
const http = require('node:http');
const crypto = require('node:crypto');
const assert = require('node:assert/strict');
const { chromium } = require('playwright');
const ROOT = path.resolve(__dirname, '..');
const OUT = path.join(ROOT, 'experiment', 'results', 'browser', 'results.json');
const PLAYER = path.join(ROOT, 'node_modules', 'asciinema-player');
const CAP = 1000, CELL_CAP = 40000; // Experimental policy candidates, not production recommendations.
const results = [];
const report = { metadata: { node: process.version, markerCap: CAP, cellCap: CELL_CAP, maxTestMarkers: 3000, repetitions: 1, caveat: 'Controlled CI measurements do not establish safe production or mobile thresholds. This run exercises total-cell checks through an adapter seam rather than the optional loader cell budget.' }, results };
fs.mkdirSync(path.dirname(OUT), { recursive: true });
const save = () => fs.writeFileSync(OUT, JSON.stringify(report, null, 2));
const hardStop = setTimeout(() => { report.fatal = 'Overall 240-second experiment deadline'; save(); process.exit(1); }, 240000);
const fixtures = new Map();
function markers(n) {
const events = [[0,'o','START\r\n'],[2.5,'o','END\r\n'],[3,'o','DONE\r\n']];
for (let i=0;i<n;i++) events.push([0.1+i*2.3/Math.max(n,1),'m',`mark-${i}`]);
events.sort((a,b)=>a[0]-b[0]);
return [JSON.stringify({version:2,width:40,height:6}),...events.map(JSON.stringify)].join('\n')+'\n';
}
for (const n of [0,100,500,1000,1001,3000]) fixtures.set(`markers-${n}`,markers(n));
for (const name of ['hello.cast','v1-pretty.cast','v3-comments.cast']) fixtures.set(name,fs.readFileSync(path.join(ROOT,'tests','fixtures',name),'utf8'));
fixtures.set('late-resize','{"version":2,"width":40,"height":6}\n[0,"o","START"]\n[1,"r","1001x24"]\n[3,"o","END"]\n');
fixtures.set('large-initial-cells','{"version":2,"width":1000,"height":1000}\n[0,"o","START"]\n[3,"o","END"]\n');
fixtures.set('large-resize-cells','{"version":2,"width":40,"height":6}\n[0,"o","START"]\n[1,"r","1000x1000"]\n[3,"o","END"]\n');
fixtures.set('compat-zero-dimensions','{"version":2,"width":0,"height":0}\n[0,"o","COMPAT\\r\\n"]\n[3,"o","done"]\n');
fixtures.set('compat-blank-lines','{"version":2,"width":40,"height":6}\n\n[0,"o","COMPAT\\r\\n"]\n[3,"o","done"]\n');
const html='<!doctype html><html><head><link rel="icon" href="data:,"><link rel="stylesheet" href="/player.css"></head><body><div id="player"></div><script src="/player.js"></script></body></html>';
const assets = new Map([
['/player.js',[path.join(PLAYER,'dist/bundle/asciinema-player.min.js'),'text/javascript']],
['/player.css',[path.join(PLAYER,'dist/bundle/asciinema-player.css'),'text/css']],
['/loader.mjs',[path.join(ROOT,'experiment/bounded-loader.mjs'),'text/javascript']]
]);
let server;
async function runCase(origin, c) {
let browser;
const errors=[];
const timer=setTimeout(()=>{results.push({...c,error:'Hard 25-second case deadline'});save();process.exit(1);},25000);
try {
browser=await chromium.launch({headless:true,timeout:10000,...(process.env.CHROMIUM_EXECUTABLE ? {executablePath:process.env.CHROMIUM_EXECUTABLE}: {}),args:['--js-flags=--max-old-space-size=256','--enable-precise-memory-info']});
report.metadata.chromium=browser.version();
const context=await browser.newContext({serviceWorkers:'block',viewport:{width:1280,height:900}});
await context.route('**/*', async route=>{
const u=new URL(route.request().url());
const allowed=u.origin===origin && (u.pathname==='/' || u.pathname==='/frame' || assets.has(u.pathname) || (u.pathname.startsWith('/fixture/') && fixtures.has(decodeURIComponent(u.pathname.slice(9)))));
if(allowed) await route.continue(); else { errors.push(`Blocked unexpected request: ${u.origin}${u.pathname}`); await route.abort(); }
});
const page=await context.newPage();page.setDefaultTimeout(10000);
page.on('pageerror', e=>errors.push(String(e)));
await page.goto(origin+'/',{waitUntil:'load'});
let frame=page.mainFrame();
if(c.realm==='iframe') {
await page.evaluate(()=>{const f=document.createElement('iframe');f.id='test-frame';f.src='/frame';document.body.appendChild(f);});
const handle=await page.waitForSelector('#test-frame');frame=await handle.contentFrame();
await frame.waitForFunction(()=>typeof AsciinemaPlayer!=='undefined');
}
const r=await frame.evaluate(async c=>{
const {loadBounded}=await import('/loader.mjs');
const heapBefore=performance.memory?.usedJSHeapSize??null;const metrics={};const before=document.querySelectorAll('*').length;
let playerCalls=0, p, data;const started=performance.now();
// Adapter seam deliberately runs after bounded parsing and before real player creation.
function checkCells(parsed) {
const h=Array.isArray(parsed)?parsed[0]:parsed;
const w=h.version===3?h.term.cols:h.width, rows=h.version===3?h.term.rows:h.height;
if(w*rows>c.cellCap) throw Error('cells');
if(Array.isArray(parsed)) for(const e of parsed.slice(1)) if(e[1]==='r') {
const [cols,rows]=e[2].split('x').map(Number);if(cols*rows>c.cellCap)throw Error('cells');
}
}
try {
const response=await fetch('/fixture/'+encodeURIComponent(c.fixture));
if(c.mode==='prototype') {data=await loadBounded(response,{markers:c.cap},metrics);checkCells(data);}
else data=await response.text();
} catch(e) {
return {rejected:true,error:e.message,playerCalls,metrics,elapsedMs:performance.now()-started,domAdded:document.querySelectorAll('*').length-before,markerElements:document.querySelectorAll('.ap-marker-container').length};
}
const loadedMs=performance.now()-started;
playerCalls++;p=AsciinemaPlayer.create({data},document.getElementById('player'),{preload:true,controls:true});
try {
await p.play();await p.pause();await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)));
void document.body.offsetHeight;
const readyMs=performance.now()-started;
const domElements=document.querySelectorAll('*').length;
const markerElements=document.querySelectorAll('.ap-marker-container').length;
const duration=await p.getDuration();
await p.seek(0);await p.play();
const playbackStart=performance.now();let advanced=0;
while(performance.now()-playbackStart<2500) {advanced=await p.getCurrentTime();if(advanced>0.02)break;await new Promise(r=>setTimeout(r,50));}
await p.pause();const seekTo=c.markerCount===undefined?Math.max(0.2,duration*0.8):2.8;
const seekStart=performance.now();await p.seek(seekTo);await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)));
const seekMs=performance.now()-seekStart,seekTime=await p.getCurrentTime();
const terminal=document.querySelector('.ap-term-text')?.textContent||'';
const heapAfter=performance.memory?.usedJSHeapSize??null;return {heapBefore,heapAfter,heapDelta:heapAfter===null?null:heapAfter-heapBefore,rejected:false,playerCalls,metrics,loadedMs,readyMs,domElements,domAdded:domElements-before,markerElements,duration,advanced,seekTo,seekTime,seekMs,terminal,playbackOk:advanced>0.02,seekOk:Math.abs(seekTime-seekTo)<0.05&&terminal.includes(c.expectedText)&&(c.markerCount===undefined||!terminal.includes('DONE'))};
} finally {p.dispose();}
},{...c,cap:CAP,cellCap:CELL_CAP});
const row={...c,...r,pageErrors:errors};results.push(row);save();
assert.deepEqual(errors,[],`${c.fixture}: browser errors or unexpected requests`);
if(c.reject) {assert.equal(r.rejected,true);assert.equal(r.error,c.reject);assert.equal(r.playerCalls,0);assert.equal(r.domAdded,0);assert.equal(r.markerElements,0);}
else {assert.equal(r.rejected,false);assert.equal(r.playerCalls,1);assert.equal(r.playbackOk,true);assert.equal(r.seekOk,true);assert.equal(r.markerElements,c.markerCount??0);assert.ok(r.duration>0);}
row.passed=true;save();console.log(JSON.stringify({fixture:c.fixture,mode:c.mode,realm:c.realm,passed:true,rejected:r.rejected,markers:r.markerElements,readyMs:r.readyMs,seekMs:r.seekMs}));
} catch(e) {results.push({...c,failed:true,error:String(e)});save();throw e;}
finally {if(browser)await browser.close();clearTimeout(timer);}
}
(async()=>{
report.metadata.player=JSON.parse(fs.readFileSync(path.join(PLAYER,'package.json'),'utf8')).version;
assert.equal(report.metadata.player,'3.17.0');
report.metadata.playwright=require('playwright/package.json').version;
report.metadata.bundleSha256=crypto.createHash('sha256').update(fs.readFileSync(assets.get('/player.js')[0])).digest('hex');save();
server=http.createServer((req,res)=>{
const u=new URL(req.url,'http://127.0.0.1');
if(req.method!=='GET'){res.writeHead(405).end();return;}
if(u.pathname==='/'||u.pathname==='/frame'){res.writeHead(200,{'Content-Type':'text/html'}).end(html);return;}
if(assets.has(u.pathname)){const [file,type]=assets.get(u.pathname);res.writeHead(200,{'Content-Type':type}).end(fs.readFileSync(file));return;}
if(u.pathname.startsWith('/fixture/')){const text=fixtures.get(decodeURIComponent(u.pathname.slice(9)));if(text!==undefined){res.writeHead(200,{'Content-Type':'application/x-asciicast'}).end(text);return;}}
res.writeHead(404).end();
});
await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));const origin=`http://127.0.0.1:${server.address().port}`;
for(const count of [0,100,500,1000,1001,3000]) for(const mode of ['baseline','prototype'])
await runCase(origin,{fixture:`markers-${count}`,markerCount:count,mode,realm:'top',expectedText:'END',...(mode==='prototype'&&count>CAP?{reject:'markers'}:{})});
for(const [fixture,expectedText] of [['hello.cast','Hello from wp-asciiplayer'],['v1-pretty.cast','Pretty v1 recording'],['v3-comments.cast','Commented v3 recording']])
for(const realm of ['top','iframe']) for(const mode of ['baseline','prototype'])await runCase(origin,{fixture,expectedText,mode,realm});
// Observe rather than hide upstream-tolerated compatibility differences.
for(const [fixture,reject] of [['compat-zero-dimensions','dimensions'],['compat-blank-lines','event']])for(const mode of ['baseline','prototype'])await runCase(origin,{fixture,expectedText:'COMPAT',mode,realm:'top',...(mode==='prototype'?{reject}:{})});
// No baseline for dangerous dimensions: zero real player calls required.
for(const [fixture,reject] of [['late-resize','dimensions'],['large-initial-cells','cells'],['large-resize-cells','cells']])await runCase(origin,{fixture,reject,mode:'prototype',realm:'top'});
report.completed=true;save();console.log(`PASS: ${results.filter(r=>r.passed).length} controlled browser cases. Marker cap ${CAP} is experimental.`);
})().catch(e=>{report.fatal=String(e);save();console.error(e);process.exitCode=1;}).finally(()=>{if(server)server.close();clearTimeout(hardStop);});
+17
View File
@@ -0,0 +1,17 @@
# Native PHP allocation experiment (not production code)
Run from an unchanged plugin checkout, with this directory copied to `experiment/php`:
php -d memory_limit=128M experiment/php/run.php /repo /results
Requires native PHP 7.4+ CLI with `proc_open`; no Python, Composer, network, or downloaded dependency is needed. Run separately under PHP 7.4 and 8.3. `/repo` is the checkout root, `/results` a writable artifact directory. A readonly checkout is supported. The controller creates only temporary data under the system temporary directory and raw outputs plus `results.json` under the specified results directory.
Suggested isolation: official `php:7.4-cli` / `php:8.3-cli` Docker images, network disabled, 512 MiB container memory, read-only root, writable 256 MiB `/tmp` tmpfs, checkout mounted `/repo:ro`, result directory mounted `/results:rw`.
Each measurement launches a fresh native PHP subprocess with `memory_limit=128M` and a 20-second controller watchdog. Synthetic fixtures stay below the existing 2 MiB v1 cap. No large fixtures are checked in. The controller compares baseline and gated validation, asserts expected acceptance/rejection and rejection positions, and requires >50% lower PHP tracked peak on both deliberately wide rejected shapes. It records exact PHP version, integer size, bytes, tracked/allocated peaks, timings, and whether decode was reached. Runtime failure, unexpected validity, insufficient reduction, or regression-test failure makes the controller exit nonzero.
The original suite (229 assertions without build/runtime.asset.php, 233 with it) runs on a temporary copy, first unchanged and then with the experimental gate injected at the start of `is_cast_v1`. All production sources remain unchanged. Thirteen focused scanner assertions also run.
The gate is a lexical budget check, not a JSON validator. It respects strings/backslash escapes without constructing a token array. Limits are experimental (100,016 containers, 400,000 scalar/key tokens, depth 15), intentionally admitting 100,000 minimal frames. Existing byte limits and downstream JSON/schema validation remain necessary. Large previously valid metadata can now be rejected, and legal 100,000-frame recordings still allocate substantial memory. CI results do not establish production WordPress memory headroom or concurrent-request safety. Timing is recorded but no speedup is promised.
All child stdout/stderr is saved, including on failure. The machine-readable summary is `/results/results.json`. Local syntax/measurement checks use WASM only; success of native CLI orchestration must be established by CI.
+14
View File
@@ -0,0 +1,14 @@
<?php
// One fresh CLI process per measurement; fixtures generated by the controller.
$root=$argv[1]; $input=$argv[2]; $mode=$argv[3];
define('ABSPATH', '/');
require $root.'/includes/uploads.php';
require __DIR__.'/preflight.php';
$text=file_get_contents($input);
if ($text === false || strlen($text)>2097152) throw new RuntimeException('Unexpected fixture size.');
$before=memory_get_usage(false); $before_real=memory_get_usage(true);
$start=microtime(true); $decoded=false; $gate=null;
if ($mode==='gated') $gate=preflight_budget($text);
if ($gate===null || $gate['ok']) {$valid=\LamGC\Asciiplayer\is_cast_v1($text);$decoded=true;}
else $valid=false;
echo json_encode(array('php'=>PHP_VERSION,'sapi'=>PHP_SAPI,'int_size'=>PHP_INT_SIZE,'mode'=>$mode,'input_bytes'=>strlen($text),'memory_limit'=>ini_get('memory_limit'),'before_bytes'=>$before,'before_real_bytes'=>$before_real,'peak_bytes'=>memory_get_peak_usage(false),'peak_real_bytes'=>memory_get_peak_usage(true),'elapsed_ms'=>round((microtime(true)-$start)*1000,3),'decoded'=>$decoded,'valid'=>$valid,'gate'=>$gate),JSON_THROW_ON_ERROR)."\n";
+28
View File
@@ -0,0 +1,28 @@
<?php
// Experiment only: a lexical resource gate, NOT a replacement JSON validator.
// Constant scanner state; no token list and no decoded object graph.
function preflight_budget($text, $container_limit = 100016, $token_limit = 400000) {
$n = strlen($text); $containers = 0; $tokens = 0; $depth = 0;
$in_string = false; $escaped = false; $in_atom = false;
for ($i = 0; $i < $n; ++$i) {
$c = $text[$i];
if ($in_string) {
if ($escaped) { $escaped = false; }
elseif ($c === '\\') { $escaped = true; }
elseif ($c === '"') { $in_string = false; }
continue;
}
if ($c === '"') { $in_string = true; $in_atom = false; ++$tokens; }
elseif ($c === '{' || $c === '[') {
$in_atom = false; ++$containers; ++$depth;
if ($depth > 15) return array('ok'=>false,'reason'=>'depth','offset'=>$i,'containers'=>$containers,'tokens'=>$tokens);
}
elseif ($c === '}' || $c === ']') { --$depth; $in_atom = false; }
elseif ($c === ',' || $c === ':' || $c === ' ' || $c === "\n" || $c === "\r" || $c === "\t") { $in_atom = false; }
elseif (!$in_atom) { ++$tokens; $in_atom = true; }
if ($containers > $container_limit || $tokens > $token_limit) {
return array('ok'=>false,'reason'=>$containers > $container_limit ? 'containers' : 'tokens','offset'=>$i,'containers'=>$containers,'tokens'=>$tokens);
}
}
return array('ok'=>true,'reason'=>'within_budget','offset'=>$n,'containers'=>$containers,'tokens'=>$tokens);
}
+61
View File
@@ -0,0 +1,61 @@
<?php
/** Native PHP 7.4+ CLI only. Usage: php -d memory_limit=128M run.php REPO_ROOT RESULTS_DIR */
if (PHP_SAPI!=='cli') throw new RuntimeException('CLI required.');
$root=realpath($argv[1] ?? dirname(__DIR__,2));
$out=$argv[2] ?? sys_get_temp_dir().'/cast-budget-results';
if (!$root || !is_file($root.'/includes/uploads.php')) throw new RuntimeException('Supply plugin checkout root.');
if (!is_dir($out) && !mkdir($out,0700,true)) throw new RuntimeException('Cannot create output directory.');
$out=realpath($out);$temp=sys_get_temp_dir().'/cast-budget-'.bin2hex(random_bytes(8));mkdir($temp,0700);
$report=array('php'=>PHP_VERSION,'sapi'=>PHP_SAPI,'memory_limit'=>'128M','timeout_seconds'=>20,'budget'=>array('containers'=>100016,'tokens'=>400000,'depth'=>15),'measurements'=>array(),'checks'=>array(),'errors'=>array());
function run_child($args,$label) {
global $out;
$stdout=$out.'/'.$label.'.stdout';$stderr=$out.'/'.$label.'.stderr';
$command=array_merge(array(PHP_BINARY,'-d','memory_limit=128M','-d','display_errors=stderr','-d','log_errors=0'),$args);
$process=proc_open($command,array(0=>array('file','/dev/null','r'),1=>array('file',$stdout,'w'),2=>array('file',$stderr,'w')),$pipes);
if (!is_resource($process)) throw new RuntimeException('Cannot start '.$label);
$deadline=microtime(true)+20;$timed_out=false;
do {$status=proc_get_status($process);if(!$status['running'])break;if(microtime(true)>$deadline){$timed_out=true;proc_terminate($process,9);break;}usleep(10000);}while(true);
$closed=proc_close($process);$exit=$status['exitcode']>=0?$status['exitcode']:$closed;
$record=array('label'=>$label,'exit_code'=>$exit,'timed_out'=>$timed_out,'stdout_file'=>basename($stdout),'stderr_file'=>basename($stderr));
if($timed_out || $exit!==0)throw new RuntimeException($label.' failed: '.json_encode($record).' '.file_get_contents($stderr));
return array($record,file_get_contents($stdout));
}
function check($condition,$label){global $report;$report['checks'][]=array('label'=>$label,'passed'=>(bool)$condition);if(!$condition)$report['errors'][]=$label;}
function copy_tree($src,$dst){if(is_dir($src)){if(!is_dir($dst))mkdir($dst,0700,true);foreach(scandir($src) as $name)if($name!=='.'&&$name!=='..')copy_tree($src.'/'.$name,$dst.'/'.$name);}else{if(!is_dir(dirname($dst)))mkdir(dirname($dst),0700,true);if(!copy($src,$dst))throw new RuntimeException('Copy failed: '.$src);}}
function clean_tree($dir){foreach(scandir($dir) as $name){if($name==='.'||$name==='..')continue;$p=$dir.'/'.$name;if(is_dir($p))clean_tree($p);else unlink($p);}rmdir($dir);}
try {
$base="{\n\"version\":1,\"width\":80,\"height\":24,\"stdout\":[[0,\"ok\"]],\"metadata\":";
$fixtures=array(
'normal-fixture'=>file_get_contents($root.'/tests/fixtures/v1-pretty.cast'),
'normal-100k-frames'=>"{\n\"version\":1,\"width\":80,\"height\":24,\"stdout\":[".str_repeat('[0,""],',99999).'[0,""]]}',
'escaped-strings'=>json_encode(array('version'=>1,'width'=>80,'height'=>24,'stdout'=>array(array(0,'\\"[{]}\\\\" ,: true false null')),'metadata'=>str_repeat('[{},',120000))),
'wide-empty-objects'=>$base.'['.str_repeat('{},',259999).'{}]}',
'wide-scalars'=>$base.'['.str_repeat('0,',799999).'0]}'
);
$properties=array();for($i=0;$i<120000;++$i)$properties[]='"k'.$i.'":0';$fixtures['wide-properties']=$base.'{'.implode(',',$properties).'}}';unset($properties);
foreach($fixtures as $name=>$contents){if(strlen($contents)>2097152)throw new RuntimeException('Fixture exceeds 2 MiB');file_put_contents($temp.'/'.$name.'.cast',$contents);}
unset($fixtures,$contents);
foreach(array('normal-fixture','normal-100k-frames','escaped-strings','wide-empty-objects','wide-scalars','wide-properties') as $name){
$pair=array();foreach(array('baseline','gated') as $mode){list($process,$text)=run_child(array(__DIR__.'/measure.php',$root,$temp.'/'.$name.'.cast',$mode),$name.'-'.$mode);$result=json_decode($text,true,512,JSON_THROW_ON_ERROR);$pair[$mode]=$result;check($result['sapi']==='cli' && $result['memory_limit']==='128M',$name.' '.$mode.' native CLI and memory limit');$report['measurements'][]=array('fixture'=>$name,'process'=>$process,'result'=>$result);}
check($pair['baseline']['valid']===true,$name.' baseline accepted');
$reject=in_array($name,array('wide-empty-objects','wide-scalars'),true);
check($pair['gated']['valid']===!$reject,$name.' expected gated validity');
check($pair['gated']['decoded']===!$reject,$name.' expected decode reached/skipped');
if($reject){check($pair['gated']['peak_bytes']<$pair['baseline']['peak_bytes']*0.5,$name.' tracked peak reduced by >50%');$expected=$name==='wide-empty-objects'?300105:800049;check($pair['gated']['gate']['offset']===$expected,$name.' expected rejection offset');}
}
list($process,$text)=run_child(array(__DIR__.'/scanner-tests.php'),'scanner-tests');check(strpos($text,'13 scanner assertions passed.')!==false,'13 scanner assertions');$report['scanner_process']=$process;
$copy=$temp.'/plugin';mkdir($copy);foreach(array('asciicast-player.php','includes','tests/php','tests/fixtures') as $item)copy_tree($root.'/'.$item,$copy.'/'.$item);
foreach(array('index.asset.php','view.asset.php','runtime.asset.php') as $item)if(is_file($root.'/build/'.$item))copy_tree($root.'/build/'.$item,$copy.'/build/'.$item);
$expected_assertions=is_file($root.'/build/runtime.asset.php')?233:229;
$report['expected_suite_assertions']=$expected_assertions;
foreach(array('baseline','gated') as $mode){
if($mode==='gated'){$source=file_get_contents($copy.'/includes/uploads.php');$needle='function is_cast_v1( $text ) {';if(substr_count($source,$needle)!==1)throw new RuntimeException('Injection marker missing/ambiguous.');$source=str_replace($needle,$needle."\n if (!\\preflight_budget(\$text)['ok']) return false;",$source);file_put_contents($copy.'/includes/uploads.php',$source);}
$wrapper=$temp.'/suite-'.$mode.'.php';file_put_contents($wrapper,"<?php require ".var_export(__DIR__.'/preflight.php',true).'; require '.var_export($copy.'/tests/php/run.php',true).';');
list($process,$text)=run_child(array($wrapper),'suite-'.$mode);preg_match('/OK: ([0-9]+) assertions passed\./',$text,$match);$count=isset($match[1])?(int)$match[1]:0;check($count===$expected_assertions,'existing '.$expected_assertions.' assertions '.$mode);$report['suite_assertion_counts'][$mode]=$count;$report['suite_processes'][$mode]=$process;
}
check($report['suite_assertion_counts']['baseline']===$report['suite_assertion_counts']['gated'],'baseline and gated suite counts equal');
} catch(Throwable $error){$report['errors'][]=$error->getMessage();}
$report['passed']=count($report['errors'])===0;
file_put_contents($out.'/results.json',json_encode($report,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR)."\n");
echo json_encode(array('passed'=>$report['passed'],'php'=>PHP_VERSION,'measurements'=>count($report['measurements']),'checks'=>count($report['checks']),'errors'=>$report['errors'],'results'=>$out.'/results.json'),JSON_THROW_ON_ERROR)."\n";
clean_tree($temp);exit($report['passed']?0:1);
+16
View File
@@ -0,0 +1,16 @@
<?php
require __DIR__.'/preflight.php';
$n=0;
function check($ok,$msg){global $n;++$n;if(!$ok)throw new Exception($msg);}
$cases=array(
array('{}',1,0),array('[]',1,0),array('{"a":[]}',2,1),
array('[0,true,false,null,-1.2e+3]',1,5),
array(json_encode(array('title'=>'[[{{,:', 'escaped'=>'\\"[{]}\\\\"','arr'=>array(0,'"'))),2,7)
);
foreach($cases as $case){$r=preflight_budget($case[0]);check($r['ok']&&$r['containers']===$case[1]&&$r['tokens']===$case[2],'count '. $case[0]);}
check(preflight_budget('[[],{}]',3,0)['ok'],'exact container boundary');
check(!preflight_budget('[[],{}]',2,0)['ok'],'container +1 rejected');
check(preflight_budget('[0,1,"x"]',1,3)['ok'],'exact token boundary');
check(!preflight_budget('[0,1,"x"]',1,2)['ok'],'token +1 rejected');
foreach(array('[','[1,]','{"x":}', '["unterminated') as $bad){$r=preflight_budget($bad);json_decode($bad,false,16);check(!$r['ok'] || json_last_error()!==JSON_ERROR_NONE,'invalid JSON rejected by final decoder');}
echo "OK: $n scanner assertions passed.\n";
+117
View File
@@ -0,0 +1,117 @@
<?php
/**
* Locally bundled, shared player assets and block registration.
*
* @package LamGC\Asciiplayer
*/
namespace LamGC\Asciiplayer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Register the block, shortcode and all plugin-scoped asset handles.
*
* @return void
*/
function register_plugin() {
load_plugin_textdomain( 'wp-asciiplayer', false, dirname( plugin_basename( PLUGIN_FILE ) ) . '/languages' );
$base = plugin_dir_url( PLUGIN_FILE ) . 'build/';
$asset = array(
'dependencies' => array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-i18n' ),
'version' => VERSION,
);
if ( file_exists( dirname( PLUGIN_FILE ) . '/build/index.asset.php' ) ) {
$asset = require dirname( PLUGIN_FILE ) . '/build/index.asset.php';
}
$view_asset = array( 'dependencies' => array( 'wp-i18n' ), 'version' => VERSION );
if ( file_exists( dirname( PLUGIN_FILE ) . '/build/view.asset.php' ) ) {
$view_asset = require dirname( PLUGIN_FILE ) . '/build/view.asset.php';
}
$versions = file_exists( dirname( PLUGIN_FILE ) . '/build/runtime.asset.php' ) ? require dirname( PLUGIN_FILE ) . '/build/runtime.asset.php' : array();
$player_version = $versions['player.js'] ?? VERSION;
wp_register_script( 'lamgc-asciiplayer-player', $base . 'player.js', array(), $player_version, true );
wp_register_script(
'lamgc-asciiplayer-view',
$base . 'view.js',
array_unique( array_merge( $view_asset['dependencies'], array( 'lamgc-asciiplayer-player' ) ) ),
$view_asset['version'],
true
);
wp_register_script(
'lamgc-asciiplayer-editor',
$base . 'index.js',
array_unique( array_merge( $asset['dependencies'], array( 'lamgc-asciiplayer-player' ) ) ),
$asset['version'],
true
);
wp_register_style( 'lamgc-asciiplayer-player-style', $base . 'player.css', array(), $versions['player.css'] ?? VERSION );
wp_register_style( 'lamgc-asciiplayer-style', $base . 'style-index.css', array( 'lamgc-asciiplayer-player-style' ), $versions['style-index.css'] ?? VERSION );
wp_register_style( 'lamgc-asciiplayer-editor-style', $base . 'index.css', array( 'lamgc-asciiplayer-player-style' ), $versions['index.css'] ?? VERSION );
wp_add_inline_script(
'lamgc-asciiplayer-editor',
'window.wpAsciiplayerSettings = ' . wp_json_encode(
array(
'playerScriptUrl' => add_query_arg( 'ver', $player_version, $base . 'player.js' ),
'playerStyleUrl' => add_query_arg( 'ver', $versions['player.css'] ?? VERSION, $base . 'player.css' ),
),
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT
) . ';',
'before'
);
wp_set_script_translations( 'lamgc-asciiplayer-view', 'wp-asciiplayer', dirname( PLUGIN_FILE ) . '/languages' );
wp_set_script_translations( 'lamgc-asciiplayer-editor', 'wp-asciiplayer', dirname( PLUGIN_FILE ) . '/languages' );
register_block_type( dirname( PLUGIN_FILE ) . '/build', array( 'render_callback' => __NAMESPACE__ . '\\render_block' ) );
add_shortcode( SHORTCODE, __NAMESPACE__ . '\\render_shortcode' );
}
/**
* Enqueue in the shared renderer as well, for widgets and template calls.
* WordPress deduplicates handles across any number of players on a page.
*
* @return void
*/
function enqueue_player_assets() {
wp_enqueue_script( 'lamgc-asciiplayer-view' );
wp_enqueue_style( 'lamgc-asciiplayer-style' );
}
/**
* Look ahead before the head is printed, including Pages and archive results.
* Render-time enqueueing remains the source of truth for indirect content.
*
* @return void
*/
function enqueue_content_assets() {
global $wp_query;
if ( empty( $wp_query->posts ) || ! is_array( $wp_query->posts ) ) {
return;
}
foreach ( $wp_query->posts as $post ) {
if ( ! is_object( $post ) || ! isset( $post->post_content ) ) {
continue;
}
if ( has_shortcode( $post->post_content, SHORTCODE ) || has_block( 'lamgc/asciiplayer', $post->post_content ) ) {
enqueue_player_assets();
return;
}
}
}
/**
* Print only our late-enqueued CSS, before footer scripts initialize players.
* This covers dynamically rendered shortcodes in widgets and classic themes.
*
* @return void
*/
function print_late_styles() {
if ( wp_style_is( 'lamgc-asciiplayer-style', 'enqueued' ) && ! wp_style_is( 'lamgc-asciiplayer-style', 'done' ) ) {
wp_print_styles( array( 'lamgc-asciiplayer-style' ) );
}
}
+299
View File
@@ -0,0 +1,299 @@
<?php
/**
* Validation shared by the shortcode and dynamic block.
*
* @package LamGC\Asciiplayer
*/
namespace LamGC\Asciiplayer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Normalize shortcode's lowercase names, camelCase block names and old aliases.
* Unknown options are intentionally discarded before reaching the player.
*
* @param mixed $attributes Input attributes.
* @return array
*/
function normalize_attributes( $attributes ) {
if ( ! is_array( $attributes ) ) {
return array();
}
$aliases = array(
'source' => 'source',
'src' => 'source',
'autoplay' => 'autoPlay',
'preload' => 'preload',
'loop' => 'loop',
'controls' => 'controls',
'fit' => 'fit',
'theme' => 'theme',
'speed' => 'speed',
'startat' => 'startAt',
'idletimelimit' => 'idleTimeLimit',
'cols' => 'cols',
'rows' => 'rows',
'fontsize' => 'terminalFontSize',
'terminalfontsize' => 'terminalFontSize',
'fontfamily' => 'terminalFontFamily',
'terminalfontfamily' => 'terminalFontFamily',
'lineheight' => 'terminalLineHeight',
'terminallineheight' => 'terminalLineHeight',
'poster' => 'poster',
'width' => 'width',
'displayalign' => 'displayAlign',
'caption' => 'caption',
'style' => 'legacyStyle',
'legacystyle' => 'legacyStyle',
);
$result = array();
foreach ( $attributes as $key => $value ) {
if ( ! is_string( $key ) || ! is_scalar( $value ) ) {
continue;
}
$key = strtolower( str_replace( array( '-', '_' ), '', $key ) );
if ( isset( $aliases[ $key ] ) ) {
$result[ $aliases[ $key ] ] = $value;
}
}
return $result;
}
/**
* Accept HTTP(S) and site-root-relative recordings, never executable schemes.
* No requests are made by PHP, and URL credentials are never emitted.
*
* @param mixed $source Recording URL.
* @return string Sanitized URL, or an empty string for invalid input.
*/
function sanitize_source( $source ) {
if ( ! is_string( $source ) ) {
return '';
}
$source = trim( html_entity_decode( $source, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) );
if ( '' === $source || preg_match( '/[\x00-\x20\x7f<>"\\\\]/', $source ) ) {
return '';
}
$parts = wp_parse_url( $source );
if ( false === $parts || ! is_array( $parts ) || isset( $parts['user'] ) || isset( $parts['pass'] ) ) {
return '';
}
if ( '/' === substr( $source, 0, 1 ) ) {
// Reject protocol-relative URLs, including slash/backslash variants.
if ( '/' === substr( $source, 1, 1 ) || isset( $parts['host'] ) || isset( $parts['scheme'] ) ) {
return '';
}
} elseif ( empty( $parts['host'] ) || empty( $parts['scheme'] ) || ! in_array( strtolower( $parts['scheme'] ), array( 'http', 'https' ), true ) ) {
return '';
}
return esc_url_raw( $source, array( 'http', 'https' ) );
}
/**
* Parse explicit false values rather than casting a nonempty string to true.
*
* @param mixed $value Input.
* @return bool|null Null indicates an unrecognized value.
*/
function parse_boolean( $value ) {
if ( is_bool( $value ) ) {
return $value;
}
if ( ! is_scalar( $value ) ) {
return null;
}
$value = strtolower( trim( (string) $value ) );
if ( in_array( $value, array( '1', 'true', 'yes', 'on' ), true ) ) {
return true;
}
if ( in_array( $value, array( '0', 'false', 'no', 'off' ), true ) ) {
return false;
}
return null;
}
/**
* Validate a finite number, retaining legitimate zero values.
*
* @param mixed $value Input.
* @param float $min Minimum value.
* @param float $max Maximum value.
* @return float|null
*/
function parse_number( $value, $min, $max ) {
if ( is_bool( $value ) || ! is_scalar( $value ) || ! is_numeric( $value ) ) {
return null;
}
$value = (float) $value;
return is_finite( $value ) && $value >= $min && $value <= $max ? $value : null;
}
/**
* Convert the player's supported timecode syntax to seconds.
*
* @param mixed $value Seconds, mm:ss or hh:mm:ss.
* @return float|null
*/
function parse_time( $value ) {
$number = parse_number( $value, 0, PHP_INT_MAX );
if ( null !== $number ) {
return $number;
}
if ( ! is_string( $value ) || ! preg_match( '/^\d+(?::[0-5]?\d){1,2}(?:\.\d+)?$/', trim( $value ) ) ) {
return null;
}
$total = 0.0;
foreach ( explode( ':', trim( $value ) ) as $part ) {
$total = $total * 60 + (float) $part;
}
return is_finite( $total ) && $total <= PHP_INT_MAX ? $total : null;
}
/**
* Return a single safe CSS length for width/font size.
*
* @param mixed $value Input.
* @param bool $font Whether player font-size names are allowed.
* @return string
*/
function sanitize_size( $value, $font = false ) {
if ( ! is_string( $value ) && ! is_numeric( $value ) ) {
return '';
}
$value = strtolower( trim( (string) $value ) );
if ( $font && in_array( $value, array( 'small', 'medium', 'big' ), true ) ) {
return $value;
}
return preg_match( '/^(?:0|(?:\d+(?:\.\d+)?|\.\d+)(?:px|%|em|rem|vw|vh|vmin|vmax|ch))$/', $value ) ? $value : '';
}
/**
* Produce only typed, supported player options; never JavaScript source.
*
* @param array $attributes Normalized attributes.
* @return array
*/
function player_options( array $attributes ) {
$options = array(
'autoPlay' => false,
'preload' => true,
'fit' => 'width',
);
foreach ( array( 'autoPlay', 'preload', 'loop' ) as $name ) {
if ( isset( $attributes[ $name ] ) ) {
$value = parse_boolean( $attributes[ $name ] );
if ( null !== $value ) {
$options[ $name ] = $value;
} elseif ( 'loop' === $name ) {
// Older shortcodes can specify a finite number of replays.
$value = parse_number( $attributes[ $name ], 1, 10000 );
if ( null !== $value && floor( $value ) === $value ) {
$options[ $name ] = (int) $value;
}
}
}
}
if ( isset( $attributes['controls'] ) ) {
$value = strtolower( trim( (string) $attributes['controls'] ) );
if ( 'auto' === $value ) {
$options['controls'] = 'auto';
} elseif ( in_array( $value, array( 'always', 'never' ), true ) ) {
$options['controls'] = 'always' === $value;
} else {
$value = parse_boolean( $attributes['controls'] );
if ( null !== $value ) {
$options['controls'] = $value;
}
}
}
if ( isset( $attributes['fit'] ) ) {
$value = strtolower( trim( (string) $attributes['fit'] ) );
if ( in_array( $value, array( 'width', 'height', 'both', 'none' ), true ) ) {
$options['fit'] = $value;
} elseif ( false === parse_boolean( $attributes['fit'] ) ) {
$options['fit'] = 'none';
}
}
if ( isset( $attributes['theme'] ) && preg_match( '/^(?:auto\/)?[a-zA-Z0-9_-]{1,64}$/', (string) $attributes['theme'] ) ) {
$options['theme'] = (string) $attributes['theme'];
}
foreach ( array( 'speed' => array( 0.01, 100 ), 'idleTimeLimit' => array( 0.001, PHP_INT_MAX ), 'terminalLineHeight' => array( 0.1, 10 ) ) as $name => $range ) {
if ( isset( $attributes[ $name ] ) ) {
$value = parse_number( $attributes[ $name ], $range[0], $range[1] );
if ( null !== $value ) {
$options[ $name ] = $value;
}
}
}
if ( isset( $attributes['startAt'] ) ) {
$value = parse_time( $attributes['startAt'] );
if ( null !== $value ) {
$options['startAt'] = $value;
}
}
foreach ( array( 'cols', 'rows' ) as $name ) {
if ( isset( $attributes[ $name ] ) ) {
$value = parse_number( $attributes[ $name ], 1, 1000 );
if ( null !== $value && floor( $value ) === $value ) {
$options[ $name ] = (int) $value;
}
}
}
if ( isset( $attributes['terminalFontSize'] ) ) {
$value = sanitize_size( $attributes['terminalFontSize'], true );
if ( '' !== $value ) {
$options['terminalFontSize'] = $value;
}
}
if ( isset( $attributes['terminalFontFamily'] ) ) {
$value = trim( (string) $attributes['terminalFontFamily'] );
if ( strlen( $value ) <= 300 && preg_match( '/^[a-zA-Z0-9 _.,\'"-]+$/', $value ) ) {
$options['terminalFontFamily'] = $value;
}
}
if ( isset( $attributes['poster'] ) ) {
$value = (string) $attributes['poster'];
if ( 0 === strpos( $value, 'npt:' ) && null !== parse_time( substr( $value, 4 ) ) ) {
$options['poster'] = $value;
} elseif ( 0 === strpos( $value, 'data:text/plain,' ) && strlen( $value ) <= 32768 ) {
$options['poster'] = $value;
}
}
return $options;
}
/**
* Filter legacy inline style, then apply the dedicated width control if set.
*
* @param array $attributes Normalized attributes.
* @return string
*/
function player_style( array $attributes ) {
$style = isset( $attributes['legacyStyle'] ) ? safecss_filter_attr( (string) $attributes['legacyStyle'] ) : '';
if ( isset( $attributes['width'] ) ) {
$width = sanitize_size( $attributes['width'] );
if ( '' !== $width ) {
$style = rtrim( $style, '; ' ) . ';width:' . $width . ';';
}
}
return ltrim( $style, '; ' );
}
+84
View File
@@ -0,0 +1,84 @@
<?php
/**
* Safe, shared rendering for shortcode and block content.
*
* @package LamGC\Asciiplayer
*/
namespace LamGC\Asciiplayer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Render one player. Invalid/missing sources produce no frontend markup.
*
* @param mixed $attributes Player attributes.
* @param string|null $content Optional legacy shortcode source.
* @param bool $block Whether WordPress block wrapper supports apply.
* @return string
*/
function render_player( $attributes = array(), $content = null, $block = false ) {
$attributes = normalize_attributes( $attributes );
$source = sanitize_source( null !== $content ? $content : ( $attributes['source'] ?? '' ) );
if ( '' === $source ) {
return '';
}
$options = wp_json_encode( player_options( $attributes ), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT );
if ( false === $options ) {
return '';
}
enqueue_player_assets();
$style = player_style( $attributes );
// The mount point owns only the player. Captions must stay outside it so
// upstream disposal/reinitialization cannot remove author-written content.
$mount_style = $style;
$figure_style = '';
if ( $block ) {
// Keep height and other legacy player-container declarations on the
// mount point. Only width moves to the figure, so captions add height.
if ( preg_match_all( '/(?:^|;)\s*width\s*:\s*([^;]+)/i', $style, $widths ) ) {
$figure_style = 'width:' . end( $widths[1] ) . ';';
}
$mount_style = trim( preg_replace( '/(^|;)\s*width\s*:[^;]*/i', '$1', $style ), '; ' );
}
$player = sprintf(
'<div class="asciiplayer-container"%1$s data-ap-src="%2$s" data-ap-options="%3$s"></div>',
'' !== $mount_style ? ' style="' . esc_attr( $mount_style ) . '"' : '',
esc_url( $source, array( 'http', 'https' ) ),
esc_attr( $options )
);
if ( ! $block ) {
return $player;
}
$alignment = isset( $attributes['displayAlign'] ) && in_array( $attributes['displayAlign'], array( 'left', 'center', 'right' ), true ) ? $attributes['displayAlign'] : 'center';
$wrapper = get_block_wrapper_attributes( array( 'class' => 'asciiplayer-block' ) );
$figure = 'class="asciiplayer-figure asciiplayer-align-' . esc_attr( $alignment ) . '"' . ( '' !== $figure_style ? ' style="' . esc_attr( $figure_style ) . '"' : '' );
// RichText emits escaped text and line breaks. No other markup is needed.
$caption = isset( $attributes['caption'] ) ? wp_kses( (string) $attributes['caption'], array( 'br' => array() ) ) : '';
return '<div ' . $wrapper . '><figure ' . $figure . '>' . $player . ( '' !== trim( $caption ) ? '<figcaption class="wp-element-caption">' . $caption . '</figcaption>' : '' ) . '</figure></div>';
}
/**
* Preserve [asciiplayer]URL[/asciiplayer] and its existing options.
*
* @param mixed $attributes Shortcode attributes.
* @param string|null $content Enclosed URL.
* @return string
*/
function render_shortcode( $attributes = array(), $content = null ) {
return null === $content ? '' : render_player( $attributes, $content );
}
/**
* Dynamic block callback. Both authoring paths use exactly the same sanitizer.
*
* @param array $attributes Block attributes.
* @return string
*/
function render_block( $attributes ) {
return render_player( $attributes, null, true );
}
+222
View File
@@ -0,0 +1,222 @@
<?php
/**
* Extension-scoped, content-validated Media Library support for asciicast files.
*
* @package LamGC\Asciiplayer
*/
namespace LamGC\Asciiplayer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
const CAST_MIME = 'application/x-asciicast';
const CAST_MAX_BYTES = 33554432; // 32 MiB; WordPress/server upload limits still apply.
const CAST_MAX_LINE_BYTES = 262144; // Bound individual JSON decodes to 256 KiB.
const CAST_MAX_V1_BYTES = 2097152; // Legacy v1 is a single JSON document, not a stream.
const CAST_MAX_EVENTS = 100000;
const CAST_MAX_DIMENSION = 1000;
/** Whether this user and, on multisite, the network permit .cast uploads. */
function can_upload_cast( $user = null ) {
$allowed = null === $user ? current_user_can( 'upload_files' ) : user_can( $user, 'upload_files' );
if ( ! $allowed ) {
return false;
}
if ( is_multisite() ) {
$extensions = preg_split( '/\s+/', strtolower( (string) get_site_option( 'upload_filetypes', '' ) ) );
return in_array( 'cast', $extensions, true );
}
return true;
}
/** Add only the .cast extension; never enable generic JSON, text, HTML or SVG. */
function allow_cast_upload_mime( $mimes, $user = null ) {
if ( can_upload_cast( $user ) ) {
$mimes['cast'] = CAST_MIME;
}
return $mimes;
}
/** A filename must actually end in .cast, including before WordPress sanitizes it. */
function is_cast_filename( $filename ) {
return is_string( $filename ) && 1 === preg_match( '/\.cast\z/i', $filename );
}
/** Finite, nonnegative seconds that remain finite in the player's milliseconds. */
function is_cast_time( $value ) {
return ( is_int( $value ) || is_float( $value ) ) && $value >= 0 && is_finite( $value * 1000 );
}
/** Bound both initial and resize dimensions before they reach the terminal. */
function is_cast_dimension( $value ) {
return is_int( $value ) && $value > 0 && $value <= CAST_MAX_DIMENSION;
}
/** Validate metadata used by asciinema-player; unknown fields remain compatible. */
function is_cast_header( $header ) {
if ( ! is_object( $header ) || ! isset( $header->version ) || ! in_array( $header->version, array( 1, 2, 3 ), true ) ) {
return false;
}
$terminal = 3 === $header->version ? ( $header->term ?? null ) : $header;
if ( ! is_object( $terminal ) ) {
return false;
}
$cols = 3 === $header->version ? ( $terminal->cols ?? null ) : ( $terminal->width ?? null );
$rows = 3 === $header->version ? ( $terminal->rows ?? null ) : ( $terminal->height ?? null );
if ( ! is_cast_dimension( $cols ) || ! is_cast_dimension( $rows ) ) {
return false;
}
foreach ( array( 'duration', 'idle_time_limit' ) as $key ) {
if ( property_exists( $header, $key ) && ! is_cast_time( $header->$key ) ) {
return false;
}
}
return true;
}
/** Validate a whole bounded legacy v1 document, including every stdout frame. */
function is_cast_v1( $text ) {
$recording = json_decode( $text, false, 16 );
if ( JSON_ERROR_NONE !== json_last_error() || ! is_cast_header( $recording ) || 1 !== $recording->version || ! isset( $recording->stdout ) || ! is_array( $recording->stdout ) || count( $recording->stdout ) > CAST_MAX_EVENTS ) {
return false;
}
$time = 0;
foreach ( $recording->stdout as $frame ) {
if ( ! is_array( $frame ) || 2 !== count( $frame ) || ! is_cast_time( $frame[0] ) || ! is_string( $frame[1] ) ) {
return false;
}
$time += $frame[0];
if ( ! is_cast_time( $time ) ) {
return false;
}
}
return true;
}
/** Validate one JSONL event, with absolute v2 time or relative v3 intervals. */
function is_cast_event( $event, $version, &$time ) {
if ( ! is_array( $event ) || 3 !== count( $event ) || ! is_cast_time( $event[0] ) || ! is_string( $event[1] ) || '' === $event[1] || ! is_string( $event[2] ) ) {
return false;
}
if ( 2 === $version && $event[0] < $time ) {
return false;
}
$time = 2 === $version ? $event[0] : $time + $event[0];
if ( ! is_cast_time( $time ) ) {
return false;
}
if ( 'r' === $event[1] ) {
if ( 1 !== preg_match( '/^([1-9][0-9]{0,3})x([1-9][0-9]{0,3})$/D', $event[2], $matches ) || ! is_cast_dimension( (int) $matches[1] ) || ! is_cast_dimension( (int) $matches[2] ) ) {
return false;
}
}
// Unknown event codes are intentionally accepted, as required by the format.
return true;
}
/**
* Inspect the entire file, not just a plausible header or a MIME guess.
*
* v2/v3 are read line by line. v1 needs a bounded complete JSON decode. Limits
* bound bytes, per-line memory, nesting and event count, including malformed input.
* Formats: https://docs.asciinema.org/manual/asciicast/ (v1, v2 and v3).
*
* @param string $path Local temporary upload path; stream wrappers are forbidden.
* @return bool
*/
function is_valid_cast_file( $path ) {
if ( ! is_string( $path ) || '' === $path || false !== strpos( $path, '://' ) || ! is_file( $path ) || ! is_readable( $path ) ) {
return false;
}
// Read-only local upload validation needs bounded streaming; WP_Filesystem reads whole files.
$handle = fopen( $path, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Local temporary upload only; wrappers rejected above.
if ( false === $handle ) {
return false;
}
try {
$stat = fstat( $handle );
if ( false === $stat || $stat['size'] < 1 || $stat['size'] > CAST_MAX_BYTES ) {
return false;
}
$line = fgets( $handle, CAST_MAX_LINE_BYTES + 2 );
if ( false === $line || strlen( $line ) > CAST_MAX_LINE_BYTES ) {
return false;
}
$header = json_decode( $line, false, 16 );
// Player 3.17 interprets a complete first-line object as JSONL and rejects
// version 1 there. Keep uploads playable: legacy v1 must be pretty-printed.
if ( is_object( $header ) && isset( $header->version ) && 1 === $header->version ) {
return false;
}
if ( ! is_cast_header( $header ) ) {
if ( $stat['size'] > CAST_MAX_V1_BYTES || 0 !== fseek( $handle, 0 ) ) {
return false;
}
$text = stream_get_contents( $handle, CAST_MAX_V1_BYTES + 1 );
return false !== $text && strlen( $text ) <= CAST_MAX_V1_BYTES && feof( $handle ) && is_cast_v1( $text );
}
$bytes = strlen( $line );
$count = 0;
$time = 0;
while ( false !== ( $line = fgets( $handle, CAST_MAX_LINE_BYTES + 2 ) ) ) {
$bytes += strlen( $line );
if ( $bytes > CAST_MAX_BYTES || strlen( $line ) > CAST_MAX_LINE_BYTES || ++$count > CAST_MAX_EVENTS ) {
return false;
}
if ( 3 === $header->version && '#' === $line[0] ) {
continue;
}
// The bundled player's JSONL parser only consumes lines starting with
// '['; reject indented events rather than silently losing their output.
if ( '[' !== $line[0] ) {
return false;
}
// Empty extra lines and non-event trailing content are not valid JSONL.
$event = json_decode( $line, false, 16 );
if ( JSON_ERROR_NONE !== json_last_error() || ! is_cast_event( $event, $header->version, $time ) ) {
return false;
}
}
return feof( $handle );
} finally {
fclose( $handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Always close the bounded read-only upload stream.
}
}
/** Reject invalid .cast uploads even for users with unfiltered_upload permission. */
function validate_cast_upload( $file ) {
if ( ! isset( $file['name'] ) || ! is_cast_filename( $file['name'] ) || ! empty( $file['error'] ) ) {
return $file;
}
$allowed = get_allowed_mime_types();
if ( ! can_upload_cast() || ! isset( $allowed['cast'] ) || CAST_MIME !== $allowed['cast'] ) {
$file['error'] = __( 'You are not allowed to upload Asciicast files.', 'wp-asciiplayer' );
} elseif ( ! is_valid_cast_file( $file['tmp_name'] ?? null ) ) {
$file['error'] = __( 'Upload a valid Asciicast v2/v3 JSONL or pretty-printed v1 .cast recording (up to 32 MiB; v1 up to 2 MiB, 100,000 events, 256 KiB per JSONL line, and 1,000 columns or rows).', 'wp-asciiplayer' );
}
return $file;
}
/** Override generic fileinfo MIME guesses only for an allowed, validated .cast. */
function check_cast_filetype( $data, $file, $filename, $mimes = null, $real_mime = false ) {
if ( ! is_cast_filename( $filename ) ) {
return $data;
}
$global_allowed = get_allowed_mime_types();
$allowed = null === $mimes ? $global_allowed : $mimes;
// wp_check_filetype() treats an empty map as its default map. Do not let an
// explicitly empty allow-list silently re-enable this extension.
$checked = is_array( $allowed ) && ! empty( $allowed ) ? wp_check_filetype( $filename, $allowed ) : array( 'ext' => false, 'type' => false );
if ( can_upload_cast() && isset( $global_allowed['cast'] ) && CAST_MIME === $global_allowed['cast'] && 'cast' === strtolower( (string) $checked['ext'] ) && CAST_MIME === $checked['type'] && is_valid_cast_file( $file ) ) {
$data['ext'] = 'cast';
$data['type'] = CAST_MIME;
$data['proper_filename'] = false;
} else {
$data['ext'] = false;
$data['type'] = false;
$data['proper_filename'] = false;
}
return $data;
}
@@ -0,0 +1,237 @@
{
"domain": "wp-asciiplayer",
"locale_data": {
"messages": {
"": {
"domain": "wp-asciiplayer",
"lang": "zh_CN",
"plural-forms": "nplurals=1; plural=0;"
},
"Columns": [
"列数"
],
"From recording": [
"使用录制尺寸"
],
"Rows": [
"行数"
],
"Placeholders show the recording’s original columns and rows once loaded. Leave blank to follow its terminal size and recorded resize events. These overrides change the character grid, not the display width, and may alter or crop the layout.": [
"加载后,占位提示会显示录制文件的原始行列数。留空可使用录制尺寸,并跟随录制中的尺寸变化。手动设置会改变字符网格,而非显示宽度,可能影响排版或裁切内容。"
],
"Use recording size": [
"使用录制尺寸"
],
"Asciinema": [
"Asciinema"
],
"Recording theme (automatic)": [
"录制文件主题(自动)"
],
"Custom": [
"自定义"
],
"Width": [
"按宽度缩放"
],
"Original size": [
"原始大小"
],
"Height (legacy)": [
"按高度缩放(旧版)"
],
"Width and height (legacy)": [
"按宽高缩放(旧版)"
],
"Example terminal recording": [
"终端录屏示例"
],
"A terminal recording, right in your post.": [
"在文章中直接播放终端录屏。"
],
"Terminal size": [
"终端尺寸"
],
"Terminal size (columns × rows)": [
"终端尺寸(列数 × 行数)"
],
"Close": [
"关闭"
],
"Display": [
"显示"
],
"Player width": [
"播放器宽度"
],
"Custom width": [
"自定义宽度"
],
"Use a CSS length, such as 480px or 65%. The player stays within its available space.": [
"使用 CSS 长度,例如 480px 或 65%。播放器不会超出可用空间。"
],
"Enter a positive width with a unit, such as 480px or 65%. The last valid width is kept.": [
"请输入带单位的正数宽度,例如 480px 或 65%。将保留上一次有效的宽度。"
],
"Display alignment": [
"对齐方式"
],
"Left": [
"左对齐"
],
"Center": [
"居中"
],
"Right": [
"右对齐"
],
"Display width scales the recording without changing its terminal columns or rows. Add a caption directly below the player.": [
"显示宽度只缩放画面,不改变终端行列数。可在播放器下方直接添加说明文字。"
],
"Playback": [
"播放"
],
"Playback speed": [
"播放速度"
],
"Loop playback": [
"循环播放"
],
"Autoplay on published page": [
"在发布后的页面自动播放"
],
"The editor preview always waits for you to press play.": [
"编辑器预览始终需要点击播放后才会开始。"
],
"Preload on published page": [
"在发布后的页面预加载"
],
"Loads the recording before the visitor presses play. The editor preview always preloads a valid recording URL.": [
"在访客点击播放前加载录制文件。编辑器预览始终会预加载有效的录制文件 URL。"
],
"Start at (seconds)": [
"起始时间(秒)"
],
"Idle time limit (seconds)": [
"最长空闲时间(秒)"
],
"Shorten long pauses. Use 0 to keep the recording’s default.": [
"缩短过长的停顿。设为 0 可保留录制文件的默认设置。"
],
"Appearance": [
"外观"
],
"Theme": [
"主题"
],
"Player controls": [
"播放控制栏"
],
"Show on interaction": [
"交互时显示"
],
"Always show": [
"始终显示"
],
"Hide": [
"隐藏"
],
"Fit": [
"缩放方式"
],
"Height-based fitting requires a fixed container height in your site CSS.": [
"按高度缩放需要在站点 CSS 中设置固定的容器高度。"
],
"The custom container style from your shortcode is preserved on the published page.": [
"发布后的页面会保留简码中的自定义容器样式。"
],
"Help": [
"帮助"
],
"A valid recording URL loads its preview automatically, including when reopening this editor. That server receives your browser’s request. Published players contact the same server. Use a direct .cast URL; external servers must allow CORS.": [
"有效的录制文件 URL 会自动加载预览,重新打开编辑器时也一样。文件所在服务器会收到浏览器请求,发布后的播放器也会访问该服务器。请使用 .cast 文件直链;外部服务器需允许跨域请求(CORS)。"
],
"Use the player controls to play, pause, and seek. Autoplay is disabled only in the editor.": [
"使用播放器控件播放、暂停和跳转。仅编辑器预览禁用自动播放。"
],
"Recording URL": [
"录制文件 URL"
],
"Apply URL": [
"应用 URL"
],
"Choose an Asciicast recording": [
"选择 Asciicast 录制文件"
],
"Choose recording": [
"选择录制文件"
],
"Choose an Asciicast (.cast) file from the Media Library.": [
"请从媒体库选择 Asciicast(.cast)文件。"
],
"Enter an HTTP(S) recording URL or a path starting with a single /.": [
"请输入 HTTP(S) 录制文件 URL,或以单个 / 开头的路径。"
],
"Asciicast Player": [
"Asciicast 播放器"
],
"Enter a recording URL to load its preview automatically. Playback starts only when you press play.": [
"输入录制文件 URL 后会自动加载预览,点击播放才会开始播放。"
],
"Add a caption…": [
"添加说明文字…"
],
"Recording caption": [
"录屏说明文字"
],
"Height-based previews use the shortcode’s fixed height when available, or a 320px editor frame. Published height still comes from your container style.": [
"按高度缩放的预览会使用简码中的固定高度;未设置时使用 320px 的编辑器预览高度。发布后的高度仍由容器样式决定。"
],
"block title\u0004Asciicast Player": [
"Asciicast 播放器"
],
"block description\u0004Embed and preview a terminal recording with the locally bundled asciinema player.": [
"使用本地附带的 asciinema 播放器嵌入和预览终端录屏。"
],
"block keyword\u0004asciinema": [
"asciinema"
],
"block keyword\u0004terminal": [
"终端"
],
"block keyword\u0004recording": [
"录屏"
],
"Unable to load the recording. Check the URL, file format, and the source server’s CORS permissions.": [
"无法加载录制文件。请检查 URL、文件格式及来源服务器的跨域请求(CORS)权限。"
],
"The recording is taking too long to load. Check your connection and try again.": [
"录制文件加载超时。请检查网络连接后重试。"
],
"The local player could not start. Try again, or check that the plugin’s built assets are installed.": [
"本地播放器无法启动。请重试,或检查插件的构建资源是否已安装。"
],
"Loading recording…": [
"正在加载录制文件…"
],
"Retry preview": [
"重试预览"
],
"Interactive terminal recording preview": [
"可交互的终端录屏预览"
],
"Unable to load this terminal recording. The file may be unavailable, invalid, or blocked by the source server’s CORS policy.": [
"无法加载此终端录屏。文件可能无法访问、格式无效,或被来源服务器的跨域请求(CORS)策略阻止。"
],
"You are not allowed to upload Asciicast files.": [
"你没有上传 Asciicast 文件的权限。"
],
"Upload a valid Asciicast v2/v3 JSONL or pretty-printed v1 .cast recording (up to 32 MiB; v1 up to 2 MiB, 100,000 events, 256 KiB per JSONL line, and 1,000 columns or rows).": [
"请上传有效的 Asciicast v2/v3 JSONL 或格式化的 v1 .cast 录制文件(最大 32 MiB;v1 最大 2 MiB;最多 100,000 个事件;每行 JSONL最大 256 KiB;列数和行数均不超过 1,000)。"
],
"Add interactive terminal recordings to posts and pages with a block or shortcode.": [
"通过区块或简码在文章和页面中添加可交互的终端录屏。"
]
}
}
}
@@ -0,0 +1,237 @@
{
"domain": "wp-asciiplayer",
"locale_data": {
"messages": {
"": {
"domain": "wp-asciiplayer",
"lang": "zh_CN",
"plural-forms": "nplurals=1; plural=0;"
},
"Columns": [
"列数"
],
"From recording": [
"使用录制尺寸"
],
"Rows": [
"行数"
],
"Placeholders show the recording’s original columns and rows once loaded. Leave blank to follow its terminal size and recorded resize events. These overrides change the character grid, not the display width, and may alter or crop the layout.": [
"加载后,占位提示会显示录制文件的原始行列数。留空可使用录制尺寸,并跟随录制中的尺寸变化。手动设置会改变字符网格,而非显示宽度,可能影响排版或裁切内容。"
],
"Use recording size": [
"使用录制尺寸"
],
"Asciinema": [
"Asciinema"
],
"Recording theme (automatic)": [
"录制文件主题(自动)"
],
"Custom": [
"自定义"
],
"Width": [
"按宽度缩放"
],
"Original size": [
"原始大小"
],
"Height (legacy)": [
"按高度缩放(旧版)"
],
"Width and height (legacy)": [
"按宽高缩放(旧版)"
],
"Example terminal recording": [
"终端录屏示例"
],
"A terminal recording, right in your post.": [
"在文章中直接播放终端录屏。"
],
"Terminal size": [
"终端尺寸"
],
"Terminal size (columns × rows)": [
"终端尺寸(列数 × 行数)"
],
"Close": [
"关闭"
],
"Display": [
"显示"
],
"Player width": [
"播放器宽度"
],
"Custom width": [
"自定义宽度"
],
"Use a CSS length, such as 480px or 65%. The player stays within its available space.": [
"使用 CSS 长度,例如 480px 或 65%。播放器不会超出可用空间。"
],
"Enter a positive width with a unit, such as 480px or 65%. The last valid width is kept.": [
"请输入带单位的正数宽度,例如 480px 或 65%。将保留上一次有效的宽度。"
],
"Display alignment": [
"对齐方式"
],
"Left": [
"左对齐"
],
"Center": [
"居中"
],
"Right": [
"右对齐"
],
"Display width scales the recording without changing its terminal columns or rows. Add a caption directly below the player.": [
"显示宽度只缩放画面,不改变终端行列数。可在播放器下方直接添加说明文字。"
],
"Playback": [
"播放"
],
"Playback speed": [
"播放速度"
],
"Loop playback": [
"循环播放"
],
"Autoplay on published page": [
"在发布后的页面自动播放"
],
"The editor preview always waits for you to press play.": [
"编辑器预览始终需要点击播放后才会开始。"
],
"Preload on published page": [
"在发布后的页面预加载"
],
"Loads the recording before the visitor presses play. The editor preview always preloads a valid recording URL.": [
"在访客点击播放前加载录制文件。编辑器预览始终会预加载有效的录制文件 URL。"
],
"Start at (seconds)": [
"起始时间(秒)"
],
"Idle time limit (seconds)": [
"最长空闲时间(秒)"
],
"Shorten long pauses. Use 0 to keep the recording’s default.": [
"缩短过长的停顿。设为 0 可保留录制文件的默认设置。"
],
"Appearance": [
"外观"
],
"Theme": [
"主题"
],
"Player controls": [
"播放控制栏"
],
"Show on interaction": [
"交互时显示"
],
"Always show": [
"始终显示"
],
"Hide": [
"隐藏"
],
"Fit": [
"缩放方式"
],
"Height-based fitting requires a fixed container height in your site CSS.": [
"按高度缩放需要在站点 CSS 中设置固定的容器高度。"
],
"The custom container style from your shortcode is preserved on the published page.": [
"发布后的页面会保留简码中的自定义容器样式。"
],
"Help": [
"帮助"
],
"A valid recording URL loads its preview automatically, including when reopening this editor. That server receives your browser’s request. Published players contact the same server. Use a direct .cast URL; external servers must allow CORS.": [
"有效的录制文件 URL 会自动加载预览,重新打开编辑器时也一样。文件所在服务器会收到浏览器请求,发布后的播放器也会访问该服务器。请使用 .cast 文件直链;外部服务器需允许跨域请求(CORS)。"
],
"Use the player controls to play, pause, and seek. Autoplay is disabled only in the editor.": [
"使用播放器控件播放、暂停和跳转。仅编辑器预览禁用自动播放。"
],
"Recording URL": [
"录制文件 URL"
],
"Apply URL": [
"应用 URL"
],
"Choose an Asciicast recording": [
"选择 Asciicast 录制文件"
],
"Choose recording": [
"选择录制文件"
],
"Choose an Asciicast (.cast) file from the Media Library.": [
"请从媒体库选择 Asciicast(.cast)文件。"
],
"Enter an HTTP(S) recording URL or a path starting with a single /.": [
"请输入 HTTP(S) 录制文件 URL,或以单个 / 开头的路径。"
],
"Asciicast Player": [
"Asciicast 播放器"
],
"Enter a recording URL to load its preview automatically. Playback starts only when you press play.": [
"输入录制文件 URL 后会自动加载预览,点击播放才会开始播放。"
],
"Add a caption…": [
"添加说明文字…"
],
"Recording caption": [
"录屏说明文字"
],
"Height-based previews use the shortcode’s fixed height when available, or a 320px editor frame. Published height still comes from your container style.": [
"按高度缩放的预览会使用简码中的固定高度;未设置时使用 320px 的编辑器预览高度。发布后的高度仍由容器样式决定。"
],
"block title\u0004Asciicast Player": [
"Asciicast 播放器"
],
"block description\u0004Embed and preview a terminal recording with the locally bundled asciinema player.": [
"使用本地附带的 asciinema 播放器嵌入和预览终端录屏。"
],
"block keyword\u0004asciinema": [
"asciinema"
],
"block keyword\u0004terminal": [
"终端"
],
"block keyword\u0004recording": [
"录屏"
],
"Unable to load the recording. Check the URL, file format, and the source server’s CORS permissions.": [
"无法加载录制文件。请检查 URL、文件格式及来源服务器的跨域请求(CORS)权限。"
],
"The recording is taking too long to load. Check your connection and try again.": [
"录制文件加载超时。请检查网络连接后重试。"
],
"The local player could not start. Try again, or check that the plugin’s built assets are installed.": [
"本地播放器无法启动。请重试,或检查插件的构建资源是否已安装。"
],
"Loading recording…": [
"正在加载录制文件…"
],
"Retry preview": [
"重试预览"
],
"Interactive terminal recording preview": [
"可交互的终端录屏预览"
],
"Unable to load this terminal recording. The file may be unavailable, invalid, or blocked by the source server’s CORS policy.": [
"无法加载此终端录屏。文件可能无法访问、格式无效,或被来源服务器的跨域请求(CORS)策略阻止。"
],
"You are not allowed to upload Asciicast files.": [
"你没有上传 Asciicast 文件的权限。"
],
"Upload a valid Asciicast v2/v3 JSONL or pretty-printed v1 .cast recording (up to 32 MiB; v1 up to 2 MiB, 100,000 events, 256 KiB per JSONL line, and 1,000 columns or rows).": [
"请上传有效的 Asciicast v2/v3 JSONL 或格式化的 v1 .cast 录制文件(最大 32 MiB;v1 最大 2 MiB;最多 100,000 个事件;每行 JSONL最大 256 KiB;列数和行数均不超过 1,000)。"
],
"Add interactive terminal recordings to posts and pages with a block or shortcode.": [
"通过区块或简码在文章和页面中添加可交互的终端录屏。"
]
}
}
}
Binary file not shown.
+367
View File
@@ -0,0 +1,367 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-asciiplayer 1.1.0-dev\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Domain: wp-asciiplayer\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Language-Team: Simplified Chinese\n"
#: src/edit.js:91
msgid "A terminal recording, right in your post."
msgstr "在文章中直接播放终端录屏。"
#: src/edit.js:139
msgid ""
"A valid recording URL loads its preview automatically, including when "
"reopening this editor. That server receives your browser’s request. "
"Published players contact the same server. Use a direct .cast URL; external "
"servers must allow CORS."
msgstr ""
"有效的录制文件 URL 会自动加载预览,重新打开编辑器时也一样。文件所在服务器会收到浏览器请求,发布后的播放器也会访问该服务器。请使用 .cast "
"文件直链;外部服务器需允许跨域请求(CORS)。"
#: src/edit.js:165
msgid "Add a caption…"
msgstr "添加说明文字…"
#: asciicast-player.php:1
msgid ""
"Add interactive terminal recordings to posts and pages with a block or "
"shortcode."
msgstr "通过区块或简码在文章和页面中添加可交互的终端录屏。"
#: src/edit.js:132
msgid "Always show"
msgstr "始终显示"
#: src/edit.js:128
msgid "Appearance"
msgstr "外观"
#: src/edit.js:147
msgid "Apply URL"
msgstr "应用 URL"
#: src/edit.js:163
#: asciicast-player.php:1
msgid "Asciicast Player"
msgstr "Asciicast 播放器"
#: src/edit.js:73
msgid "Asciinema"
msgstr "Asciinema"
#: src/edit.js:123
msgid "Autoplay on published page"
msgstr "在发布后的页面自动播放"
#: src/edit.js:116
msgid "Center"
msgstr "居中"
#: src/edit.js:154
msgid "Choose an Asciicast (.cast) file from the Media Library."
msgstr "请从媒体库选择 Asciicast(.cast)文件。"
#: src/edit.js:150
msgid "Choose an Asciicast recording"
msgstr "选择 Asciicast 录制文件"
#: src/edit.js:151
msgid "Choose recording"
msgstr "选择录制文件"
#: src/edit.js:104
msgid "Close"
msgstr "关闭"
#: src/edit.js:12
msgid "Columns"
msgstr "列数"
#: src/edit.js:81
msgid "Custom"
msgstr "自定义"
#: src/edit.js:115
msgid "Custom width"
msgstr "自定义宽度"
#: src/edit.js:113
msgid "Display"
msgstr "显示"
#: src/edit.js:116
msgid "Display alignment"
msgstr "对齐方式"
#: src/edit.js:117
msgid ""
"Display width scales the recording without changing its terminal columns or "
"rows. Add a caption directly below the player."
msgstr "显示宽度只缩放画面,不改变终端行列数。可在播放器下方直接添加说明文字。"
#: src/edit.js:115
msgid ""
"Enter a positive width with a unit, such as 480px or 65%. The last valid "
"width is kept."
msgstr "请输入带单位的正数宽度,例如 480px 或 65%。将保留上一次有效的宽度。"
#: src/edit.js:163
msgid ""
"Enter a recording URL to load its preview automatically. Playback starts "
"only when you press play."
msgstr "输入录制文件 URL 后会自动加载预览,点击播放才会开始播放。"
#: src/edit.js:155
msgid "Enter an HTTP(S) recording URL or a path starting with a single /."
msgstr "请输入 HTTP(S) 录制文件 URL,或以单个 / 开头的路径。"
#: src/edit.js:91
msgid "Example terminal recording"
msgstr "终端录屏示例"
#: src/edit.js:135
msgid "Fit"
msgstr "缩放方式"
#: src/edit.js:12
#: src/edit.js:13
msgid "From recording"
msgstr "使用录制尺寸"
#: src/edit.js:89
msgid "Height (legacy)"
msgstr "按高度缩放(旧版)"
#: src/edit.js:135
msgid "Height-based fitting requires a fixed container height in your site CSS."
msgstr "按高度缩放需要在站点 CSS 中设置固定的容器高度。"
#: src/edit.js:167
msgid ""
"Height-based previews use the shortcode’s fixed height when available, or a "
"320px editor frame. Published height still comes from your container style."
msgstr "按高度缩放的预览会使用简码中的固定高度;未设置时使用 320px 的编辑器预览高度。发布后的高度仍由容器样式决定。"
#: src/edit.js:138
msgid "Help"
msgstr "帮助"
#: src/edit.js:133
msgid "Hide"
msgstr "隐藏"
#: src/edit.js:126
msgid "Idle time limit (seconds)"
msgstr "最长空闲时间(秒)"
#: src/preview.js:85
msgid "Interactive terminal recording preview"
msgstr "可交互的终端录屏预览"
#: src/edit.js:116
msgid "Left"
msgstr "左对齐"
#: src/preview.js:83
msgid "Loading recording…"
msgstr "正在加载录制文件…"
#: src/edit.js:124
msgid ""
"Loads the recording before the visitor presses play. The editor preview "
"always preloads a valid recording URL."
msgstr "在访客点击播放前加载录制文件。编辑器预览始终会预加载有效的录制文件 URL。"
#: src/edit.js:122
msgid "Loop playback"
msgstr "循环播放"
#: src/edit.js:87
msgid "Original size"
msgstr "原始大小"
#: src/edit.js:15
msgid ""
"Placeholders show the recording’s original columns and rows once loaded. "
"Leave blank to follow its terminal size and recorded resize events. These "
"overrides change the character grid, not the display width, and may alter "
"or crop the layout."
msgstr "加载后,占位提示会显示录制文件的原始行列数。留空可使用录制尺寸,并跟随录制中的尺寸变化。手动设置会改变字符网格,而非显示宽度,可能影响排版或裁切内容。"
#: src/edit.js:120
msgid "Playback"
msgstr "播放"
#: src/edit.js:121
msgid "Playback speed"
msgstr "播放速度"
#: src/edit.js:130
msgid "Player controls"
msgstr "播放控制栏"
#: src/edit.js:114
msgid "Player width"
msgstr "播放器宽度"
#: src/edit.js:124
msgid "Preload on published page"
msgstr "在发布后的页面预加载"
#: src/edit.js:165
msgid "Recording caption"
msgstr "录屏说明文字"
#: src/edit.js:74
msgid "Recording theme (automatic)"
msgstr "录制文件主题(自动)"
#: src/edit.js:146
msgid "Recording URL"
msgstr "录制文件 URL"
#: src/preview.js:84
msgid "Retry preview"
msgstr "重试预览"
#: src/edit.js:116
msgid "Right"
msgstr "右对齐"
#: src/edit.js:13
msgid "Rows"
msgstr "行数"
#: src/edit.js:126
msgid "Shorten long pauses. Use 0 to keep the recording’s default."
msgstr "缩短过长的停顿。设为 0 可保留录制文件的默认设置。"
#: src/edit.js:131
msgid "Show on interaction"
msgstr "交互时显示"
#: src/edit.js:125
msgid "Start at (seconds)"
msgstr "起始时间(秒)"
#: src/edit.js:99
#: src/edit.js:101
#: src/edit.js:110
msgid "Terminal size"
msgstr "终端尺寸"
#: src/edit.js:102
msgid "Terminal size (columns × rows)"
msgstr "终端尺寸(列数 × 行数)"
#: src/edit.js:136
msgid ""
"The custom container style from your shortcode is preserved on the "
"published page."
msgstr "发布后的页面会保留简码中的自定义容器样式。"
#: src/edit.js:123
msgid "The editor preview always waits for you to press play."
msgstr "编辑器预览始终需要点击播放后才会开始。"
#: src/preview.js:70
msgid ""
"The local player could not start. Try again, or check that the plugin’s "
"built assets are installed."
msgstr "本地播放器无法启动。请重试,或检查插件的构建资源是否已安装。"
#: src/preview.js:68
msgid ""
"The recording is taking too long to load. Check your connection and try "
"again."
msgstr "录制文件加载超时。请检查网络连接后重试。"
#: src/edit.js:129
msgid "Theme"
msgstr "主题"
#: src/preview.js:59
msgid ""
"Unable to load the recording. Check the URL, file format, and the source "
"server’s CORS permissions."
msgstr "无法加载录制文件。请检查 URL、文件格式及来源服务器的跨域请求(CORS)权限。"
#: src/view.js:12
msgid ""
"Unable to load this terminal recording. The file may be unavailable, "
"invalid, or blocked by the source server’s CORS policy."
msgstr "无法加载此终端录屏。文件可能无法访问、格式无效,或被来源服务器的跨域请求(CORS)策略阻止。"
#: includes/uploads.php:197
msgid ""
"Upload a valid Asciicast v2/v3 JSONL or pretty-printed v1 .cast recording "
"(up to 32 MiB; v1 up to 2 MiB, 100,000 events, 256 KiB per JSONL line, and "
"1,000 columns or rows)."
msgstr ""
"请上传有效的 Asciicast v2/v3 JSONL 或格式化的 v1 .cast 录制文件(最大 32 MiB;v1 最大 2 MiB;最多 "
"100,000 个事件;每行 JSONL最大 256 KiB;列数和行数均不超过 1,000)。"
#: src/edit.js:115
msgid ""
"Use a CSS length, such as 480px or 65%. The player stays within its "
"available space."
msgstr "使用 CSS 长度,例如 480px 或 65%。播放器不会超出可用空间。"
#: src/edit.js:16
msgid "Use recording size"
msgstr "使用录制尺寸"
#: src/edit.js:140
msgid ""
"Use the player controls to play, pause, and seek. Autoplay is disabled only "
"in the editor."
msgstr "使用播放器控件播放、暂停和跳转。仅编辑器预览禁用自动播放。"
#: src/edit.js:86
msgid "Width"
msgstr "按宽度缩放"
#: src/edit.js:89
msgid "Width and height (legacy)"
msgstr "按宽高缩放(旧版)"
#: includes/uploads.php:195
msgid "You are not allowed to upload Asciicast files."
msgstr "你没有上传 Asciicast 文件的权限。"
#: src/index.js:19
#: block.json:1
msgctxt "block description"
msgid ""
"Embed and preview a terminal recording with the locally bundled asciinema "
"player."
msgstr "使用本地附带的 asciinema 播放器嵌入和预览终端录屏。"
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "asciinema"
msgstr "asciinema"
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "recording"
msgstr "录屏"
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "terminal"
msgstr "终端"
#: src/index.js:18
#: block.json:1
msgctxt "block title"
msgid "Asciicast Player"
msgstr "Asciicast 播放器"
+360
View File
@@ -0,0 +1,360 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-asciiplayer 1.1.0-dev\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Domain: wp-asciiplayer\n"
#: src/edit.js:91
msgid "A terminal recording, right in your post."
msgstr ""
#: src/edit.js:139
msgid ""
"A valid recording URL loads its preview automatically, including when "
"reopening this editor. That server receives your browser’s request. "
"Published players contact the same server. Use a direct .cast URL; external "
"servers must allow CORS."
msgstr ""
#: src/edit.js:165
msgid "Add a caption…"
msgstr ""
#: asciicast-player.php:1
msgid ""
"Add interactive terminal recordings to posts and pages with a block or "
"shortcode."
msgstr ""
#: src/edit.js:132
msgid "Always show"
msgstr ""
#: src/edit.js:128
msgid "Appearance"
msgstr ""
#: src/edit.js:147
msgid "Apply URL"
msgstr ""
#: src/edit.js:163
#: asciicast-player.php:1
msgid "Asciicast Player"
msgstr ""
#: src/edit.js:73
msgid "Asciinema"
msgstr ""
#: src/edit.js:123
msgid "Autoplay on published page"
msgstr ""
#: src/edit.js:116
msgid "Center"
msgstr ""
#: src/edit.js:154
msgid "Choose an Asciicast (.cast) file from the Media Library."
msgstr ""
#: src/edit.js:150
msgid "Choose an Asciicast recording"
msgstr ""
#: src/edit.js:151
msgid "Choose recording"
msgstr ""
#: src/edit.js:104
msgid "Close"
msgstr ""
#: src/edit.js:12
msgid "Columns"
msgstr ""
#: src/edit.js:81
msgid "Custom"
msgstr ""
#: src/edit.js:115
msgid "Custom width"
msgstr ""
#: src/edit.js:113
msgid "Display"
msgstr ""
#: src/edit.js:116
msgid "Display alignment"
msgstr ""
#: src/edit.js:117
msgid ""
"Display width scales the recording without changing its terminal columns or "
"rows. Add a caption directly below the player."
msgstr ""
#: src/edit.js:115
msgid ""
"Enter a positive width with a unit, such as 480px or 65%. The last valid "
"width is kept."
msgstr ""
#: src/edit.js:163
msgid ""
"Enter a recording URL to load its preview automatically. Playback starts "
"only when you press play."
msgstr ""
#: src/edit.js:155
msgid "Enter an HTTP(S) recording URL or a path starting with a single /."
msgstr ""
#: src/edit.js:91
msgid "Example terminal recording"
msgstr ""
#: src/edit.js:135
msgid "Fit"
msgstr ""
#: src/edit.js:12
#: src/edit.js:13
msgid "From recording"
msgstr ""
#: src/edit.js:89
msgid "Height (legacy)"
msgstr ""
#: src/edit.js:135
msgid "Height-based fitting requires a fixed container height in your site CSS."
msgstr ""
#: src/edit.js:167
msgid ""
"Height-based previews use the shortcode’s fixed height when available, or a "
"320px editor frame. Published height still comes from your container style."
msgstr ""
#: src/edit.js:138
msgid "Help"
msgstr ""
#: src/edit.js:133
msgid "Hide"
msgstr ""
#: src/edit.js:126
msgid "Idle time limit (seconds)"
msgstr ""
#: src/preview.js:85
msgid "Interactive terminal recording preview"
msgstr ""
#: src/edit.js:116
msgid "Left"
msgstr ""
#: src/preview.js:83
msgid "Loading recording…"
msgstr ""
#: src/edit.js:124
msgid ""
"Loads the recording before the visitor presses play. The editor preview "
"always preloads a valid recording URL."
msgstr ""
#: src/edit.js:122
msgid "Loop playback"
msgstr ""
#: src/edit.js:87
msgid "Original size"
msgstr ""
#: src/edit.js:15
msgid ""
"Placeholders show the recording’s original columns and rows once loaded. "
"Leave blank to follow its terminal size and recorded resize events. These "
"overrides change the character grid, not the display width, and may alter "
"or crop the layout."
msgstr ""
#: src/edit.js:120
msgid "Playback"
msgstr ""
#: src/edit.js:121
msgid "Playback speed"
msgstr ""
#: src/edit.js:130
msgid "Player controls"
msgstr ""
#: src/edit.js:114
msgid "Player width"
msgstr ""
#: src/edit.js:124
msgid "Preload on published page"
msgstr ""
#: src/edit.js:165
msgid "Recording caption"
msgstr ""
#: src/edit.js:74
msgid "Recording theme (automatic)"
msgstr ""
#: src/edit.js:146
msgid "Recording URL"
msgstr ""
#: src/preview.js:84
msgid "Retry preview"
msgstr ""
#: src/edit.js:116
msgid "Right"
msgstr ""
#: src/edit.js:13
msgid "Rows"
msgstr ""
#: src/edit.js:126
msgid "Shorten long pauses. Use 0 to keep the recording’s default."
msgstr ""
#: src/edit.js:131
msgid "Show on interaction"
msgstr ""
#: src/edit.js:125
msgid "Start at (seconds)"
msgstr ""
#: src/edit.js:99
#: src/edit.js:101
#: src/edit.js:110
msgid "Terminal size"
msgstr ""
#: src/edit.js:102
msgid "Terminal size (columns × rows)"
msgstr ""
#: src/edit.js:136
msgid ""
"The custom container style from your shortcode is preserved on the "
"published page."
msgstr ""
#: src/edit.js:123
msgid "The editor preview always waits for you to press play."
msgstr ""
#: src/preview.js:70
msgid ""
"The local player could not start. Try again, or check that the plugin’s "
"built assets are installed."
msgstr ""
#: src/preview.js:68
msgid ""
"The recording is taking too long to load. Check your connection and try "
"again."
msgstr ""
#: src/edit.js:129
msgid "Theme"
msgstr ""
#: src/preview.js:59
msgid ""
"Unable to load the recording. Check the URL, file format, and the source "
"server’s CORS permissions."
msgstr ""
#: src/view.js:12
msgid ""
"Unable to load this terminal recording. The file may be unavailable, "
"invalid, or blocked by the source server’s CORS policy."
msgstr ""
#: includes/uploads.php:197
msgid ""
"Upload a valid Asciicast v2/v3 JSONL or pretty-printed v1 .cast recording "
"(up to 32 MiB; v1 up to 2 MiB, 100,000 events, 256 KiB per JSONL line, and "
"1,000 columns or rows)."
msgstr ""
#: src/edit.js:115
msgid ""
"Use a CSS length, such as 480px or 65%. The player stays within its "
"available space."
msgstr ""
#: src/edit.js:16
msgid "Use recording size"
msgstr ""
#: src/edit.js:140
msgid ""
"Use the player controls to play, pause, and seek. Autoplay is disabled only "
"in the editor."
msgstr ""
#: src/edit.js:86
msgid "Width"
msgstr ""
#: src/edit.js:89
msgid "Width and height (legacy)"
msgstr ""
#: includes/uploads.php:195
msgid "You are not allowed to upload Asciicast files."
msgstr ""
#: src/index.js:19
#: block.json:1
msgctxt "block description"
msgid ""
"Embed and preview a terminal recording with the locally bundled asciinema "
"player."
msgstr ""
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "asciinema"
msgstr ""
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "recording"
msgstr ""
#: src/index.js:20
#: block.json:1
msgctxt "block keyword"
msgid "terminal"
msgstr ""
#: src/index.js:18
#: block.json:1
msgctxt "block title"
msgid "Asciicast Player"
msgstr ""
+183
View File
@@ -0,0 +1,183 @@
{
"notice": "License texts are preserved from the specified upstream versions or release commits. Dependency inventories describe upstream source declarations, not an independently generated binary SBOM.",
"sources": [
{
"file": "avt-LICENSE",
"source": "https://raw.githubusercontent.com/asciinema/avt/v0.16.0/LICENSE"
},
{
"file": "rgb-LICENSE",
"source": "https://raw.githubusercontent.com/kornelski/rust-rgb/v0.8.50/LICENSE"
},
{
"file": "unicode-width-LICENSE",
"source": "https://raw.githubusercontent.com/unicode-rs/unicode-width/v0.1.14/LICENSE-MIT"
},
{
"file": "unicode-width-COPYRIGHT-LICENSE",
"source": "https://raw.githubusercontent.com/unicode-rs/unicode-width/v0.1.14/COPYRIGHT"
},
{
"file": "bytemuck-LICENSE",
"source": "https://raw.githubusercontent.com/Lokathor/bytemuck/v1.18.0/LICENSE-MIT"
},
{
"file": "talc-LICENSE",
"source": "https://raw.githubusercontent.com/SFBdragon/talc/9e75a551c30bd82661e366ede044ba4695826966/LICENSE.md"
},
{
"file": "allocator-api2-LICENSE",
"source": "https://raw.githubusercontent.com/zakarumych/allocator-api2/5b163e41f5f6b68969a65dc7afe8a6a9d3d49ccb/LICENSE-MIT"
},
{
"file": "lock_api-LICENSE",
"source": "https://raw.githubusercontent.com/Amanieu/parking_lot/lock_api-v0.4.14/LICENSE-MIT"
},
{
"file": "scopeguard-LICENSE",
"source": "https://raw.githubusercontent.com/bluss/scopeguard/v1.2.0/LICENSE-MIT"
},
{
"file": "serde-LICENSE",
"source": "https://raw.githubusercontent.com/serde-rs/serde/v1.0.203/LICENSE-MIT"
},
{
"file": "serde-wasm-bindgen-LICENSE",
"source": "https://raw.githubusercontent.com/RReverser/serde-wasm-bindgen/v0.6.5/LICENSE"
},
{
"file": "wasm-bindgen-LICENSE",
"source": "https://raw.githubusercontent.com/wasm-bindgen/wasm-bindgen/0.2.106/LICENSE-MIT"
},
{
"file": "cfg-if-LICENSE",
"source": "https://raw.githubusercontent.com/rust-lang/cfg-if/1.0.0/LICENSE-MIT"
},
{
"file": "once_cell-LICENSE",
"source": "https://raw.githubusercontent.com/matklad/once_cell/v1.17.1/LICENSE-MIT"
},
{
"file": "serde_json-LICENSE",
"source": "https://raw.githubusercontent.com/serde-rs/json/v1.0.93/LICENSE-MIT"
},
{
"file": "ryu-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/ryu/1.0.12/LICENSE-APACHE"
},
{
"file": "itoa-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/itoa/1.0.5/LICENSE-MIT"
},
{
"file": "solid-js-LICENSE",
"source": "https://raw.githubusercontent.com/solidjs/solid/v1.9.6/LICENSE"
},
{
"file": "solid-primitives-LICENSE",
"source": "https://raw.githubusercontent.com/solidjs-community/solid-primitives/@solid-primitives/[email protected]/LICENSE",
"additional_verified_sources": [
"https://raw.githubusercontent.com/solidjs-community/solid-primitives/@solid-primitives/[email protected]/LICENSE",
"https://raw.githubusercontent.com/solidjs-community/solid-primitives/@solid-primitives/[email protected]/LICENSE"
]
},
{
"file": "babel-runtime-LICENSE",
"source": "https://raw.githubusercontent.com/babel/babel/v7.27.0/LICENSE"
},
{
"file": "regenerator-runtime-LICENSE",
"source": "https://raw.githubusercontent.com/facebook/regenerator/v0.14.1/LICENSE"
},
{
"file": "csstype-LICENSE",
"source": "https://raw.githubusercontent.com/frenic/csstype/v3.1.1/LICENSE"
},
{
"file": "seroval-LICENSE",
"source": "https://raw.githubusercontent.com/lxsmnsyc/seroval/1.5.0/LICENSE"
},
{
"file": "seroval-plugins-LICENSE",
"source": "https://raw.githubusercontent.com/lxsmnsyc/seroval/v1.3.0/LICENSE"
},
{
"file": "js-sys-LICENSE",
"source": "https://raw.githubusercontent.com/wasm-bindgen/wasm-bindgen/0.2.84/LICENSE-MIT"
},
{
"file": "rustversion-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/rustversion/1.0.22/LICENSE-MIT"
},
{
"file": "proc-macro2-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/proc-macro2/1.0.84/LICENSE-MIT"
},
{
"file": "quote-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/quote/1.0.36/LICENSE-MIT"
},
{
"file": "syn-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/syn/2.0.66/LICENSE-MIT"
},
{
"file": "bumpalo-LICENSE",
"source": "https://raw.githubusercontent.com/fitzgen/bumpalo/3.12.0/LICENSE-MIT"
},
{
"file": "unicode-ident-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/unicode-ident/1.0.6/LICENSE-UNICODE"
},
{
"file": "unicode-ident-MIT-LICENSE",
"source": "https://raw.githubusercontent.com/dtolnay/unicode-ident/1.0.6/LICENSE-MIT"
},
{
"file": "asciinema-player-LICENSE",
"source": "https://github.com/asciinema/asciinema-player/blob/v3.17.0/LICENSE"
},
{
"file": "vt-js-LICENSE-APACHE",
"source": "https://github.com/asciinema/asciinema-player/blob/v3.17.0/src/vt/LICENSE_APACHE"
},
{
"file": "vt-js-LICENSE-MIT",
"source": "https://github.com/asciinema/asciinema-player/blob/v3.17.0/src/vt/LICENSE_MIT"
},
{
"file": "rust-1.85.0-LICENSE-MIT",
"source": "https://github.com/rust-lang/rust/blob/1.85.0/LICENSE-MIT"
},
{
"file": "rust-1.85.0-COPYRIGHT",
"source": "https://github.com/rust-lang/rust/blob/1.85.0/COPYRIGHT"
},
{
"file": "compiler-builtins-LICENSE",
"source": "https://raw.githubusercontent.com/rust-lang/compiler-builtins/compiler_builtins-v0.1.140/LICENSE.txt"
},
{
"file": "upstream-asciinema-player-Cargo.lock",
"source": "https://github.com/asciinema/asciinema-player/blob/v3.17.0/src/vt/Cargo.lock"
},
{
"file": "upstream-npm-production-dependencies.json",
"source": "https://github.com/asciinema/asciinema-player/blob/v3.17.0/package-lock.json",
"note": "Non-dev entries extracted; includes root package metadata."
},
{
"file": "solid-transition-group-LICENSE",
"source": "npm:[email protected]/LICENSE",
"note": "Copied byte-for-byte from installed official npm package; exact upstream version."
},
{
"file": "rust-1.85.0-LICENSE-APACHE",
"source": "https://raw.githubusercontent.com/rust-lang/rust/1.85.0/LICENSE-APACHE"
},
{
"file": "compiler-rt-CREDITS",
"source": "https://raw.githubusercontent.com/llvm/llvm-project/main/compiler-rt/CREDITS.TXT"
}
]
}
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2011-2021 Marcin Kulik
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+22
View File
@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2019 Nick Fitzgerald
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+9
View File
@@ -0,0 +1,9 @@
MIT License
Copyright (c) 2019 Daniel "Lokathor" Gee.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2014 Alex Crichton
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+270
View File
@@ -0,0 +1,270 @@
compiler-builtins as a whole is available for use under both the MIT license
and the Apache-2.0 license with the LLVM exception (MIT AND Apache-2.0 WITH
LLVM-exception).
As a contributor, you agree that your code can be used under either the MIT
license, or the Apache-2.0 license, or the Apache-2.0 license with the LLVM
exception.
Text of the relevant licenses is provided below:
------------------------------------------------------------------------------
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
------------------------------------------------------------------------------
Portions of this software are derived from third-party works licensed under
terms compatible with the above Apache-2.0 WITH LLVM-exception AND MIT
license:
* compiler-builtins is derived from LLVM's compiler-rt (https://llvm.org/).
Work derived from compiler-rt prior to 2019-01-19 is usable under the MIT
license, with the following copyright:
Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT
The relevant CREDITS.TXT is located at
https://github.com/llvm/llvm-project/blob/main/compiler-rt/CREDITS.TXT.
* Work derived from compiler-rt after 2019-01-19 is usable under the
Apache-2.0 license with the LLVM exception.
* The bundled `math` module is from rust-lang/libm, usable under the MIT
license. See https://github.com/rust-lang/libm for details.
Additionally, some source files may contain comments with specific copyrights
or licenses.
+36
View File
@@ -0,0 +1,36 @@
This file is a partial list of people who have contributed to the LLVM/CompilerRT
project. If you have contributed a patch or made some other contribution to
LLVM/CompilerRT, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Craig van Vliet
E: [email protected]
W: http://www.auroraux.org
D: Code style and Readability fixes.
N: Edward O'Callaghan
E: [email protected]
W: http://www.auroraux.org
D: CMake'ify Compiler-RT build system
D: Maintain Solaris & AuroraUX ports of Compiler-RT
N: Howard Hinnant
E: [email protected]
D: Architect and primary author of compiler-rt
N: Guan-Hong Liu
E: [email protected]
D: IEEE Quad-precision functions
N: Joerg Sonnenberger
E: [email protected]
D: Maintains NetBSD port.
N: Matt Thomas
E: [email protected]
D: ARM improvements.
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2017-2018 Fredrik Nicol
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2014 Alex Crichton
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2016 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2014-present, Facebook, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Kornel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+384
View File
@@ -0,0 +1,384 @@
Short version for non-lawyers:
The Rust Project is dual-licensed under Apache 2.0 and MIT
terms.
Longer version:
Copyrights in the Rust project are retained by their contributors. No
copyright assignment is required to contribute to the Rust project.
Some files include explicit copyright notices and/or license notices.
For full authorship information, see the version control history or
https://thanks.rust-lang.org
Except as otherwise noted (below and/or in individual files), Rust is
licensed under the Apache License, Version 2.0 <LICENSE-APACHE> or
<http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT> or <http://opensource.org/licenses/MIT>, at your option.
The Rust Project includes packages written by third parties.
The following third party packages are included, and carry
their own copyright notices and license terms:
* LLVM, located in src/llvm-project, is licensed under the following
terms.
==============================================================================
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
==============================================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
==============================================================================
Software from third parties included in the LLVM Project:
==============================================================================
The LLVM Project contains third party software which is under different license
terms. All such code will be identified clearly using at least one of two
mechanisms:
1) It will be in a separate directory tree with its own `LICENSE.txt` or
`LICENSE` file at the top containing the specific license and restrictions
which apply to that software, or
2) It will contain specific license and restriction terms at the top of every
file.
==============================================================================
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
* Portions of the FFI code for interacting with the native ABI
is derived from the Clay programming language, which carries
the following license.
Copyright (C) 2008-2010 Tachyon Technologies.
All rights reserved.
Redistribution and use in source and binary forms, with
or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
* Portions of internationalization code use code or data from Unicode, which
carry the following license:
UNICODE LICENSE V3
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2024 Unicode, Inc.
NOTICE TO USER: Carefully read the following legal agreement. BY
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a
copy of data files and any associated documentation (the "Data Files") or
software and any associated documentation (the "Software") to deal in the
Data Files or Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, and/or sell
copies of the Data Files or Software, and to permit persons to whom the
Data Files or Software are furnished to do so, provided that either (a)
this copyright and permission notice appear with all copies of the Data
Files or Software, or (b) this copyright and permission notice appear in
associated Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in these Data Files or Software without prior written
authorization of the copyright holder.
+176
View File
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2016-2019 Ulrik Sverdrup "bluss" and scopeguard developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Cloudflare, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Alexis Munsayac
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Alexis Munsayac
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2025 Ryan Carniato
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Solid Core Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-2021 Ryan Carniato
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright © 2026 Shaun Beautement
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+46
View File
@@ -0,0 +1,46 @@
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
See Terms of Use <https://www.unicode.org/copyright.html>
for definitions of Unicode Inc.’s Data Files and Software.
NOTICE TO USER: Carefully read the following legal agreement.
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT.
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
THE DATA FILES OR SOFTWARE.
COPYRIGHT AND PERMISSION NOTICE
Copyright © 1991-2022 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
+23
View File
@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+7
View File
@@ -0,0 +1,7 @@
Licensed under the Apache License, Version 2.0
<LICENSE-APACHE or
http://www.apache.org/licenses/LICENSE-2.0> or the MIT
license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
at your option. All files in the project carrying such
notice may not be copied, modified, or distributed except
according to those terms.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2015 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+308
View File
@@ -0,0 +1,308 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "allocator-api2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c880a97d28a3681c0267bd29cff89621202715b065127cd445fa0f0fe0aa2880"
[[package]]
name = "avt"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "156203bcce48a54533c6a718509c22825c1ebbb606e6b313a6f13e8c6097bd13"
dependencies = [
"rgb",
"unicode-width",
]
[[package]]
name = "bumpalo"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]]
name = "bytemuck"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "itoa"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]]
name = "js-sys"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lock_api"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
"scopeguard",
]
[[package]]
name = "once_cell"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "proc-macro2"
version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rgb"
version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
dependencies = [
"bytemuck",
]
[[package]]
name = "rustversion"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ryu"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]]
name = "scoped-tls"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde-wasm-bindgen"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b"
dependencies = [
"js-sys",
"serde",
"wasm-bindgen",
]
[[package]]
name = "serde_derive"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "syn"
version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "talc"
version = "5.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3081e3f3ad542dc4cd0ae720f752598f8880fd364dc2d031132e3509f673aa23"
dependencies = [
"allocator-api2",
"lock_api",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]]
name = "vt-js"
version = "0.1.0"
dependencies = [
"avt",
"serde",
"serde-wasm-bindgen",
"talc",
"wasm-bindgen",
"wasm-bindgen-test",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"serde",
"serde_json",
"wasm-bindgen-macro",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-bindgen-test"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db36fc0f9fb209e88fb3642590ae0205bb5a56216dabd963ba15879fe53a30b"
dependencies = [
"console_error_panic_hook",
"js-sys",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-bindgen-test-macro",
]
[[package]]
name = "wasm-bindgen-test-macro"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0734759ae6b3b1717d661fe4f016efcfb9828f5edb4520c18eaee05af3b43be9"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "web-sys"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
dependencies = [
"js-sys",
"wasm-bindgen",
]
@@ -0,0 +1,137 @@
{
"": {
"name": "asciinema-player",
"version": "3.17.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.21.0",
"solid-js": "^1.3.0",
"solid-transition-group": "^0.2.3"
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/plugin-transform-runtime": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@playwright/test": "^1.56.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.5",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-terser": "^1.0.0",
"@wasm-tool/rollup-plugin-rust": "^3.1.4",
"babel-preset-solid": "^1.6.13",
"eslint": "^7.27.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.4.0",
"less": "^4.1.1",
"prettier": "3.2.5",
"rollup": "^4.43.0"
}
},
"node_modules/@babel/runtime": {
"version": "7.27.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz",
"integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==",
"license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@solid-primitives/refs": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@solid-primitives/refs/-/refs-1.1.2.tgz",
"integrity": "sha512-K7tf2thy7L+YJjdqXspXOg5xvNEOH8tgEWsp0+1mQk3obHBRD6hEjYZk7p7FlJphSZImS35je3UfmWuD7MhDfg==",
"license": "MIT",
"dependencies": {
"@solid-primitives/utils": "^6.3.2"
},
"peerDependencies": {
"solid-js": "^1.6.12"
}
},
"node_modules/@solid-primitives/transition-group": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@solid-primitives/transition-group/-/transition-group-1.1.2.tgz",
"integrity": "sha512-gnHS0OmcdjeoHN9n7Khu8KNrOlRc8a2weETDt2YT6o1zeW/XtUC6Db3Q9pkMU/9cCKdEmN4b0a/41MKAHRhzWA==",
"license": "MIT",
"peerDependencies": {
"solid-js": "^1.6.12"
}
},
"node_modules/@solid-primitives/utils": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/@solid-primitives/utils/-/utils-6.3.2.tgz",
"integrity": "sha512-hZ/M/qr25QOCcwDPOHtGjxTD8w2mNyVAYvcfgwzBHq2RwNqHNdDNsMZYap20+ruRwW4A3Cdkczyoz0TSxLCAPQ==",
"license": "MIT",
"peerDependencies": {
"solid-js": "^1.6.12"
}
},
"node_modules/csstype": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz",
"integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/seroval": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/seroval/-/seroval-1.5.0.tgz",
"integrity": "sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10"
}
},
"node_modules/seroval-plugins": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.3.0.tgz",
"integrity": "sha512-FFu/UE3uA8L1vj0CXXZo2Nlh10MtYoOs0G//ptwlQMjfPFSeIVYUNy0zewfV8iM0CrOebAfHEG6J3xA9c+lsaQ==",
"license": "MIT",
"engines": {
"node": ">=10"
},
"peerDependencies": {
"seroval": "^1.0"
}
},
"node_modules/solid-js": {
"version": "1.9.6",
"resolved": "https://registry.npmjs.org/solid-js/-/solid-js-1.9.6.tgz",
"integrity": "sha512-PoasAJvLk60hRtOTe9ulvALOdLjjqxuxcGZRolBQqxOnXrBXHGzqMT4ijNhGsDAYdOgEa8ZYaAE94PSldrFSkA==",
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.1.0",
"seroval": "^1.1.0",
"seroval-plugins": "^1.1.0"
}
},
"node_modules/solid-transition-group": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/solid-transition-group/-/solid-transition-group-0.2.3.tgz",
"integrity": "sha512-iB72c9N5Kz9ykRqIXl0lQohOau4t0dhel9kjwFvx81UZJbVwaChMuBuyhiZmK24b8aKEK0w3uFM96ZxzcyZGdg==",
"license": "MIT",
"dependencies": {
"@solid-primitives/refs": "^1.0.5",
"@solid-primitives/transition-group": "^1.0.2"
},
"engines": {
"node": ">=18.0.0",
"pnpm": ">=8.6.0"
},
"peerDependencies": {
"solid-js": "^1.6.12"
}
}
}
+176
View File
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2018 Marcin Kulik <[email protected]>
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2014 Alex Crichton
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+23433
View File
File diff suppressed because it is too large Load Diff
+58
View File
@@ -0,0 +1,58 @@
{
"name": "wp-asciiplayer",
"version": "1.1.0-dev",
"private": true,
"description": "Native WordPress asciicast block with real playback previews and compatible shortcodes",
"type": "module",
"license": "GPL-3.0-only",
"engines": {
"node": "^24.18.0 || >=26.0.0",
"npm": ">=11.16.0"
},
"scripts": {
"build": "wp-scripts build --config webpack.config.cjs && node scripts/vendor.mjs && npm run i18n && node scripts/verify-build.mjs",
"start": "wp-scripts start --config webpack.config.cjs",
"test": "npm run i18n:check && node --test tests/js/*.test.js",
"test:php": "php tests/php/run.php",
"test:e2e": "playwright test",
"wp-env": "wp-env",
"package": "node scripts/package.mjs",
"i18n": "node scripts/i18n.mjs",
"i18n:check": "node scripts/i18n.mjs --check"
},
"dependencies": {
"asciinema-player": "3.17.0"
},
"devDependencies": {
"@playwright/test": "1.64.0",
"@wordpress/env": "11.17.0",
"@wordpress/scripts": "36.1.0",
"@babel/parser": "8.0.7",
"gettext-parser": "9.1.1"
},
"cssnano": {
"preset": [
"default",
{
"discardComments": {
"removeAll": false
}
}
]
},
"overrides": {
"copy-webpack-plugin": {
"serialize-javascript": "7.0.5"
},
"markdownlint-cli": {
"js-yaml": "5.4.3",
"smol-toml": "1.9.1"
},
"express": {
"qs": "6.16.0"
},
"simple-git": {
"@simple-git/argv-parser": "2.0.1"
}
}
}
+21
View File
@@ -0,0 +1,21 @@
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e',
fullyParallel: false,
workers: 1,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 1 : 0,
timeout: 90_000,
expect: { timeout: 20_000 },
reporter: [['list'], ['html', { open: 'never' }]],
outputDir: 'test-results',
use: {
baseURL: process.env.WP_BASE_URL || 'http://localhost:8888',
launchOptions: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH ? { executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH } : {},
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
});
+34 -35
View File
@@ -1,59 +1,58 @@
=== Asciicast Player === === Asciicast Player ===
Contributors: lamgc Contributors: lamgc
Tags: asciicast, asciiplayer, asciinema, ascii Tags: asciicast, asciiplayer, asciinema, terminal, block
Requires at least: 5.2 Requires at least: 6.3
Tested up to: 6.2 Tested up to: 7.1
Stable tag: 1.0.1
Requires PHP: 7.4 Requires PHP: 7.4
License: GPLv3 Stable tag: 1.1.0-dev
License: GPL-3.0-only
License URI: https://www.gnu.org/licenses/gpl-3.0.html License URI: https://www.gnu.org/licenses/gpl-3.0.html
Play Asciicast files in WordPress posts. Play terminal recordings with a native block, real editor playback previews, and compatible shortcodes.
== Description == == Description ==
You can find the source code for all versions on [Github](https://github.com/LamGC/wp-asciiplayer). Insert an Asciicast Player block, apply a recording-file URL, and play it directly in the editor. Configure theme, speed, looping, controls, sizing, start time and idle-time limit. Existing [asciiplayer] shortcodes remain supported without rewriting your posts.
This plugin helps you insert Asciicast files into the post, better presenting terminal operations to readers. * Locally bundled asciinema-player, JavaScript, CSS and WebAssembly.
* Native block-editor controls and iframe-aware interactive preview.
* Compatible shortcode rendering in posts and pages.
* Automatic preview loading for valid URLs, debounced editing, and clear loading/failure feedback.
* Media Library selection and validated .cast uploads using existing WordPress upload permissions.
* No account, analytics, remote proxy, custom post type or extra upload capabilities.
## Quick start The source and reproducible build instructions are included in the ZIP and available at https://github.com/LamGC/wp-asciiplayer . Third-party licenses are in THIRD-PARTY-NOTICES.md and licenses/.
Add a shortcode to the post and enter the following: = External recordings and privacy =
``` The plugin itself uses no external runtime service. When you choose an external recording URL, the visitor's browser requests that URL directly. The host may receive IP address, browser request metadata and a referrer according to browser/site policy. A valid URL automatically loads the editor preview and makes the same request, including when reopening a saved block. Choose a trusted host and consult its privacy policy. Use a same-site HTTPS recording URL to avoid third-party requests. Review terminal output for sensitive data before publishing.
[asciiplayer]https://asciinema.org/a/28307.cast[/asciiplayer]
```
The content of the shortcode is the URL of the ascicast file. == Installation ==
### Options 1. Upload the built wp-asciiplayer.zip using Plugins → Add New → Upload Plugin.
2. Activate Asciicast Player.
3. Insert an Asciicast Player block or retain your existing shortcode.
The AsciiPlayer shortcode supports the options supported by Asciinema-player, such as setting `fit` to `height` and closing the control bar: A GitHub source ZIP needs npm ci and npm run build before installation. See SOURCE.md for packaging instructions.
``` == Frequently Asked Questions ==
[asciiplayer fit="height" controls="false"]https://asciinema.org/a/28307.cast[/asciiplayer]
```
You can find all available options [here](https://www.npmjs.com/package/asciinema-player#options). = Does it change old articles? =
> Currently, only the `logger` option is not supported because it requires an object to be passed in. No. The [asciiplayer] shortcode remains available. You can explicitly convert supported shortcodes to blocks and review them before saving.
#### Style options = Why does a remote recording fail to load? =
For the convenience of customizing player elements, Use a recording-file URL rather than a share-page URL. The remote server must permit cross-origin (CORS) requests. HTTPS sites may block HTTP recordings. Network errors, invalid formats or missing files can also prevent playback. The plugin does not work around these restrictions through a server proxy.
the plugin has added an additional `style` **option**,
which corresponds to the `style` **attribute** of the player container element:
``` = Are player resources loaded from a CDN? =
[asciiplayer style="width: 80%;"]https://asciinema.org/a/28307.cast[/asciiplayer]
```
== Changelog == No. The JavaScript, CSS and WebAssembly ship with the plugin. The previous ap_use_local_resources setting is no longer used.
= 1.0.0 = = Is the Classic Editor supported? =
* Set the version attribute for the resource file in WordPress.
* Added some documents.
= 0.1.0 = Existing shortcodes work in the Classic Editor. The new visual controls and inline playback preview are for the block editor.
* The first available version.
* Update asciinema-player version to 3.4.0 = Which languages are included? =
English (en_US fallback) and Simplified Chinese (zh_CN) are bundled and work offline. Plugin-owned editor controls follow the WordPress user language; public pages follow the site language. Set these in Users > Profile and Settings > General. Other Chinese locales, including zh_TW, are not mapped to zh_CN. Recording output and author captions are never translated. The upstream player's own controls and help remain English.
+84
View File
@@ -0,0 +1,84 @@
/** Deterministic gettext catalogs. English msgids are the en_US fallback. */
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { parse } from '@babel/parser';
import gettext from 'gettext-parser';
const domain = 'wp-asciiplayer';
const version = JSON.parse(fs.readFileSync('package.json')).version;
const entries = new Map();
function add(msgid, context, file, line) {
assert.equal(typeof msgid, 'string', `Static gettext string required: ${file}:${line}`);
const key = `${context || ''}\u0004${msgid}`;
if (!entries.has(key)) entries.set(key, { msgid, msgctxt: context || undefined, msgstr: [''], comments: { reference: '' } });
const entry = entries.get(key);
entry.comments.reference += `${entry.comments.reference ? '\n' : ''}${file}:${line}`;
}
function walk(node, file) {
if (!node || typeof node !== 'object') return;
if (node.type === 'CallExpression' && ['__', '_x', '_n', '_nx'].includes(node.callee?.name)) {
const name = node.callee.name;
assert.ok(['__', '_x'].includes(name), `Add plural extraction before using ${name}: ${file}`);
const args = node.arguments;
assert.equal(args[name === '__' ? 1 : 2]?.value, domain, `Explicit textdomain required: ${file}`);
assert.equal(args[0]?.type, 'StringLiteral', `Literal gettext message required: ${file}`);
if (name === '_x') assert.equal(args[1]?.type, 'StringLiteral');
add(args[0].value, name === '_x' ? args[1].value : '', file, node.loc.start.line);
}
for (const value of Object.values(node)) {
if (Array.isArray(value)) for (const child of value) walk(child, file);
else if (value && typeof value === 'object') walk(value, file);
}
}
for (const file of fs.readdirSync('src').filter((name) => name.endsWith('.js')).map((name) => `src/${name}`)) {
walk(parse(fs.readFileSync(file, 'utf8'), { sourceType: 'module', plugins: ['jsx'] }), file);
}
for (const file of ['asciicast-player.php', ...fs.readdirSync('includes').filter((name) => name.endsWith('.php')).map((name) => `includes/${name}`)]) {
const source = fs.readFileSync(file, 'utf8');
const calls = [...source.matchAll(/\b__\s*\(/g)];
const matches = [...source.matchAll(/\b__\(\s*'((?:\\.|[^'\\])*)'\s*,\s*'wp-asciiplayer'\s*\)/g)];
assert.equal(matches.length, calls.length, `Unsupported PHP gettext syntax in ${file}; extend extractor first.`);
assert.ok(!/\b(?:_x|_n|_nx|_e|esc_html__|esc_attr__)\s*\(/.test(source), `Extend PHP extractor for new gettext functions: ${file}`);
for (const match of matches) add(match[1].replace(/\\(['\\])/g, '$1'), '', file, source.slice(0, match.index).split('\n').length);
}
const pluginHeader = fs.readFileSync('asciicast-player.php', 'utf8');
for (const label of ['Plugin Name', 'Description']) {
const value = pluginHeader.match(new RegExp(` \* ${label}: (.+)`))?.[1];
if (value) add(value, '', 'asciicast-player.php', 1);
}
const metadata = JSON.parse(fs.readFileSync('block.json'));
for (const [field, context] of [['title', 'block title'], ['description', 'block description'], ['keywords', 'block keyword']]) {
for (const value of [].concat(metadata[field])) add(value, context, 'block.json', 1);
}
const headers = { 'Project-Id-Version': `${domain} ${version}`, 'MIME-Version': '1.0', 'Content-Type': 'text/plain; charset=UTF-8', 'Content-Transfer-Encoding': '8bit', 'X-Domain': domain };
const pot = { charset: 'utf-8', headers, translations: { '': {} } };
for (const entry of [...entries.values()].sort((a, b) => `${a.msgctxt || ''}\u0004${a.msgid}`.localeCompare(`${b.msgctxt || ''}\u0004${b.msgid}`, 'en'))) {
const context = entry.msgctxt || '';
(pot.translations[context] ||= {})[entry.msgid] = entry;
}
fs.mkdirSync('languages', { recursive: true });
const output = new Map([['languages/wp-asciiplayer.pot', gettext.po.compile(pot)]]);
if (!process.argv.includes('--pot-only')) {
const po = gettext.po.parse(fs.readFileSync('languages/wp-asciiplayer-zh_CN.po'));
assert.equal(po.headers.Language, 'zh_CN');
assert.match(po.headers['Plural-Forms'], /^nplurals=1;\s*plural=0;$/);
const messages = { '': { domain, lang: 'zh_CN', 'plural-forms': 'nplurals=1; plural=0;' } };
for (const entry of entries.values()) {
const translation = po.translations[entry.msgctxt || '']?.[entry.msgid];
assert.ok(translation?.msgstr?.[0], `Missing zh_CN translation: ${entry.msgid}`);
assert.ok(!translation.comments?.flag?.includes('fuzzy'), `Fuzzy translation: ${entry.msgid}`);
assert.ok(!translation.msgid_plural && translation.msgstr.length === 1, `Unexpected plural: ${entry.msgid}`);
const placeholders = (text) => [...text.matchAll(/%(?:\d+\$)?[sdif]/g)].map((match) => match[0]).sort();
assert.deepEqual(placeholders(translation.msgstr[0]), placeholders(entry.msgid), `Placeholder mismatch: ${entry.msgid}`);
messages[entry.msgctxt ? `${entry.msgctxt}\u0004${entry.msgid}` : entry.msgid] = translation.msgstr;
}
output.set('languages/wp-asciiplayer-zh_CN.mo', gettext.mo.compile(po));
const json = `${JSON.stringify({ domain, locale_data: { messages } }, null, 2)}\n`;
for (const handle of ['lamgc-asciiplayer-editor', 'lamgc-asciiplayer-view']) output.set(`languages/wp-asciiplayer-zh_CN-${handle}.json`, json);
}
for (const [file, content] of output) {
if (process.argv.includes('--check')) assert.deepEqual(fs.readFileSync(file), Buffer.from(content), `Stale catalog: ${file}; run npm run i18n.`);
else fs.writeFileSync(file, content);
}
console.log(`Verified ${entries.size} gettext entries; ${output.size} reproducible artifacts${process.argv.includes('--check') ? ' checked' : ' written'}.`);
+39
View File
@@ -0,0 +1,39 @@
import { cp, mkdir, mkdtemp, readdir, readFile, rm, stat, utimes } from 'node:fs/promises';
import { execFileSync } from 'node:child_process';
import path from 'node:path';
import os from 'node:os';
const root = path.resolve(import.meta.dirname, '..');
execFileSync(process.execPath, ['scripts/i18n.mjs', '--check'], { cwd: root, stdio: 'inherit' });
const required = ['build/block.json', 'build/index.js', 'build/index.asset.php', 'build/view.js', 'build/view.asset.php', 'build/player.js', 'build/player.css', 'build/runtime.asset.php', 'languages/wp-asciiplayer-zh_CN.mo', 'languages/wp-asciiplayer-zh_CN-lamgc-asciiplayer-editor.json', 'languages/wp-asciiplayer-zh_CN-lamgc-asciiplayer-view.json'];
for (const file of required) await stat(path.join(root, file));
const pkg = JSON.parse(await readFile(path.join(root, 'package.json'), 'utf8'));
const php = await readFile(path.join(root, 'asciicast-player.php'), 'utf8');
const readme = await readFile(path.join(root, 'readme.txt'), 'utf8');
if (!php.includes(`Version: ${pkg.version}`) || !readme.includes(`Stable tag: ${pkg.version}`)) throw new Error('Version headers disagree.');
const temp = await mkdtemp(path.join(os.tmpdir(), 'wp-asciiplayer-package-'));
const target = path.join(temp, 'wp-asciiplayer');
const inputs = ['asciicast-player.php', 'includes', 'build', 'languages', 'LICENSE', 'licenses', 'THIRD-PARTY-NOTICES.md', 'README.md', 'README-zh.md', 'readme.txt', 'SOURCE.md', 'src', 'block.json', 'package.json', 'package-lock.json', 'webpack.config.cjs', 'babel.config.json', 'scripts'];
try {
await mkdir(target);
for (const file of inputs) await cp(path.join(root, file), path.join(target, file), { recursive: true });
const files = [];
async function walk(dir) {
for (const entry of (await readdir(dir, { withFileTypes: true })).sort((a,b) => a.name.localeCompare(b.name, 'en'))) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) await walk(full);
else if (entry.isFile()) {
await utimes(full, new Date('2026-01-01T00:00:00Z'), new Date('2026-01-01T00:00:00Z'));
files.push(path.relative(temp, full));
} else throw new Error(`Unexpected non-regular archive entry: ${full}`);
}
}
await walk(target);
await mkdir(path.join(root, 'dist'), { recursive: true });
const zip = path.join(root, 'dist/wp-asciiplayer.zip');
await rm(zip, { force: true });
execFileSync('zip', ['-X', '-q', zip, ...files], { cwd: temp, env: { ...process.env, TZ: 'UTC' } });
console.log(`Created ${zip} (${files.length} files), version ${pkg.version}.`);
} finally {
await rm(temp, { recursive: true, force: true });
}
+24
View File
@@ -0,0 +1,24 @@
import { copyFile, mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { createHash } from 'node:crypto';
const root = path.resolve(import.meta.dirname, '..');
const pkg = JSON.parse(await readFile(path.join(root, 'node_modules/asciinema-player/package.json'), 'utf8'));
if (pkg.version !== '3.17.0') throw new Error(`Unexpected player version: ${pkg.version}`);
await mkdir(path.join(root, 'build'), { recursive: true });
for (const [source, destination] of [
['dist/bundle/asciinema-player.min.js', 'player.js'],
['dist/bundle/asciinema-player.css', 'player.css'],
]) {
await copyFile(path.join(root, 'node_modules/asciinema-player', source), path.join(root, 'build', destination));
}
await copyFile(path.join(root, 'block.json'), path.join(root, 'build/block.json'));
console.log(`Bundled local asciinema-player ${pkg.version}; no CDN is used.`);
// Content hashes avoid stale assets across successive builds of 1.1.0-dev.
const versions = [];
for (const file of ['player.js', 'player.css', 'style-index.css', 'index.css']) {
const hash = createHash('sha256').update(await readFile(path.join(root, 'build', file))).digest('hex').slice(0, 16);
versions.push(`'${file}' => '${hash}'`);
}
await writeFile(path.join(root, 'build/runtime.asset.php'), `<?php return array(${versions.join(', ')});\n`);
+61
View File
@@ -0,0 +1,61 @@
import { readFile } from 'node:fs/promises';
import { createHash } from 'node:crypto';
import { runInNewContext } from 'node:vm';
import assert from 'node:assert/strict';
const hash = (data) => createHash('sha256').update(data).digest('hex');
const asset = await readFile('build/index.asset.php', 'utf8');
if (asset.includes('react-jsx-runtime')) throw new Error('Automatic JSX runtime would break the WordPress 6.3 baseline.');
for (const dependency of ['wp-blocks', 'wp-block-editor', 'wp-element', 'wp-compose']) {
if (!asset.includes(`'${dependency}'`)) throw new Error(`Missing editor dependency: ${dependency}`);
}
for (const [destination, original] of [
['build/player.js', 'node_modules/asciinema-player/dist/bundle/asciinema-player.min.js'],
['build/player.css', 'node_modules/asciinema-player/dist/bundle/asciinema-player.css'],
]) {
if (hash(await readFile(destination)) !== hash(await readFile(original))) throw new Error(`Vendor file mismatch: ${destination}`);
}
const metadata = JSON.parse(await readFile('build/block.json', 'utf8'));
if (metadata.apiVersion !== 3 || metadata.name !== 'lamgc/asciiplayer') throw new Error('Unexpected block metadata.');
// Execute the emitted bundle too: source-only tests miss minifier scope errors.
// In particular, never shadow the global document used by mountPlayers' default.
const view = await readFile('build/view.js', 'utf8');
for (const readyState of ['loading', 'complete']) {
let mounts = 0;
let onReady;
const container = {
dataset: { apSrc: '/recording.cast', apOptions: '{"preload":false}' },
};
const document = {
readyState,
body: { classList: { contains: () => false } },
querySelector: () => null,
querySelectorAll: () => [container],
addEventListener(event, callback) {
assert.equal(event, 'DOMContentLoaded');
onReady = callback;
},
defaultView: { AsciinemaPlayer: { create(source, target) {
assert.equal(source, '/recording.cast');
assert.equal(target, container);
mounts++;
return { addEventListener() {} };
} } },
};
runInNewContext(view, { document, window: { wp: { i18n: { __: (text) => text } } }, URL });
if (readyState === 'loading') {
assert.equal(mounts, 0);
onReady();
onReady(); // A repeated boot must not mount the same container twice.
}
assert.equal(mounts, 1, `Frontend boot failed at readyState=${readyState}`);
assert.equal(container.dataset.apStatus, 'idle');
}
console.log('Verified WordPress 6.3 dependencies, block metadata, exact vendor files, and emitted frontend boot.');
// Physical placement and terminal direction must not be mirrored by RTLCSS.
for (const suffix of ['', '-rtl']) {
const css = await readFile(`build/style-index${suffix}.css`, 'utf8');
assert.match(css, /asciiplayer-align-left\{[^}]*margin-left:0!important[^}]*margin-right:auto!important/);
assert.match(css, /asciiplayer-align-right\{[^}]*margin-left:auto!important[^}]*margin-right:0!important/);
assert.match(css, /asciiplayer-container \.ap-wrapper\{text-align:left/);
}
+171
View File
@@ -0,0 +1,171 @@
import { BlockAlignmentToolbar, BlockControls, InspectorControls, MediaUpload, MediaUploadCheck, RichText, useBlockProps } from '@wordpress/block-editor';
import { Button, Dropdown, Notice, PanelBody, Placeholder, RangeControl, SelectControl, TextControl, ToggleControl, ToolbarButton, ToolbarGroup } from '@wordpress/components';
import { useCallback, useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { finiteNumber, normalizeDisplayAlign, normalizeSource, normalizeWidth, terminalDimension } from './options.js';
import Preview from './preview.js';
/** One shared set of dimension controls in the block toolbar and settings sidebar. */
function TerminalSizeControls( { attributes, setAttributes, recordingSize } ) {
return <>
<div className="asciiplayer-editor__dimension-fields">
<TextControl label={ __( 'Columns', 'wp-asciiplayer' ) } type="number" min="1" max="1000" step="1" value={ attributes.cols ?? '' } placeholder={ recordingSize ? String( recordingSize.cols ) : __( 'From recording', 'wp-asciiplayer' ) } onChange={ ( value ) => setAttributes( { cols: terminalDimension( value ) } ) } />
<TextControl label={ __( 'Rows', 'wp-asciiplayer' ) } type="number" min="1" max="1000" step="1" value={ attributes.rows ?? '' } placeholder={ recordingSize ? String( recordingSize.rows ) : __( 'From recording', 'wp-asciiplayer' ) } onChange={ ( value ) => setAttributes( { rows: terminalDimension( value ) } ) } />
</div>
<p className="asciiplayer-editor__hint">{ __( 'Placeholders show the recording’s original columns and rows once loaded. Leave blank to follow its terminal size and recorded resize events. These overrides change the character grid, not the display width, and may alter or crop the layout.', 'wp-asciiplayer' ) }</p>
<Button variant="secondary" onClick={ () => setAttributes( { cols: undefined, rows: undefined } ) }>{ __( 'Use recording size', 'wp-asciiplayer' ) }</Button>
</>;
}
export default function Edit( { attributes, setAttributes, isSelected } ) {
const { source, theme, speed, loop, controls, fit, startAt, idleTimeLimit, autoPlay, preload, width, caption, displayAlign } = attributes;
const [ draftSource, setDraftSource ] = useState( source );
const [ urlError, setUrlError ] = useState( false );
const [ mediaError, setMediaError ] = useState( false );
const [ recording, setRecording ] = useState( null );
const onRecordingSize = useCallback( ( loadedSource, size ) => setRecording( { source: loadedSource, size } ), [] );
const [ attempt, setAttempt ] = useState( 0 );
const [ draftWidth, setDraftWidth ] = useState( width );
useEffect( () => setDraftWidth( width ), [ width ] );
useEffect( () => {
setDraftSource( source );
setRecording( null );
setUrlError( Boolean( source.trim() ) && ! normalizeSource( source ) );
}, [ source ] );
// Saved/undone sources load immediately. Typed changes wait until the user
// pauses, and submitting the form applies the same URL without that delay.
useEffect( () => {
if ( attributes.isExample || draftSource === source ) return undefined;
const timer = setTimeout( () => {
const next = normalizeSource( draftSource );
setUrlError( Boolean( draftSource.trim() ) && ! next );
if ( next || ! draftSource.trim() ) setAttributes( { source: next } );
}, 500 );
return () => clearTimeout( timer );
}, [ draftSource, source, attributes.isExample, setAttributes ] );
const previewSource = normalizeSource( source );
const showPreview = previewSource && previewSource === normalizeSource( draftSource );
const recordingSize = showPreview && recording?.source === previewSource ? recording.size : null;
const blockProps = useBlockProps( { className: 'asciiplayer-editor' } );
const applySource = ( event ) => {
event.preventDefault();
const next = normalizeSource( draftSource );
setUrlError( ! next );
if ( ! next ) return;
setAttributes( { source: next } );
setDraftSource( next );
setAttempt( ( current ) => current + 1 );
};
const selectRecording = ( media ) => {
const next = normalizeSource( media?.url );
if ( ! next || ! /\.cast$/i.test( next.split( /[?#]/ )[ 0 ] ) ) {
setMediaError( true );
return;
}
setMediaError( false );
setUrlError( false );
setRecording( null );
setDraftSource( next );
setAttributes( { source: next } );
setAttempt( ( current ) => current + 1 );
};
const themes = [
{ label: __( 'Asciinema', 'wp-asciiplayer' ), value: 'asciinema' },
{ label: __( 'Recording theme (automatic)', 'wp-asciiplayer' ), value: 'auto/asciinema' },
{ label: 'Dracula', value: 'dracula' }, { label: 'Monokai', value: 'monokai' },
{ label: 'Nord', value: 'nord' }, { label: 'Solarized Dark', value: 'solarized-dark' },
{ label: 'Solarized Light', value: 'solarized-light' }, { label: 'Tango', value: 'tango' },
];
if ( ! themes.some( ( option ) => option.value === theme ) ) themes.push( { label: theme, value: theme } );
const widthPresets = [ '100%', '80%', '60%', '50%', '25%' ];
const widthOptions = [ ...widthPresets.map( ( value ) => ( { label: value, value } ) ), { label: __( 'Custom', 'wp-asciiplayer' ), value: 'custom' } ];
const [ customWidth, setCustomWidth ] = useState( ! widthPresets.includes( width ) );
const widthValid = draftWidth.trim() !== '' && normalizeWidth( draftWidth ) === draftWidth.trim() && parseFloat( draftWidth ) > 0;
const placement = normalizeDisplayAlign( displayAlign );
const fitOptions = [
{ label: __( 'Width', 'wp-asciiplayer' ), value: 'width' },
{ label: __( 'Original size', 'wp-asciiplayer' ), value: 'none' },
];
if ( fit === 'height' || fit === 'both' ) fitOptions.push( { label: fit === 'height' ? __( 'Height (legacy)', 'wp-asciiplayer' ) : __( 'Width and height (legacy)', 'wp-asciiplayer' ), value: fit } );
if ( attributes.isExample ) {
return <div { ...blockProps }><figure className="asciiplayer-example" aria-label={ __( 'Example terminal recording', 'wp-asciiplayer' ) }><div className="asciiplayer-example__terminal"><span>$ printf 'Hello, terminal!\n'</span><br /><span>Hello, terminal!</span><br /><span>$ <span aria-hidden="true">▋</span></span></div><div className="asciiplayer-example__controls" aria-hidden="true">▶ ━━━━━━━━━━━ 0:00 / 0:12</div><figcaption>{ __( 'A terminal recording, right in your post.', 'wp-asciiplayer' ) }</figcaption></figure></div>;
}
return (
<>
<BlockControls group="other">
<BlockAlignmentToolbar value={ placement } controls={ [ 'left', 'center', 'right' ] } onChange={ ( value ) => setAttributes( { displayAlign: normalizeDisplayAlign( value ) } ) } />
<ToolbarGroup>
<Dropdown contentClassName="asciiplayer-terminal-popover" popoverProps={ { placement: 'bottom-start' } } renderToggle={ ( { isOpen, onToggle } ) => (
<ToolbarButton icon="editor-table" label={ __( 'Terminal size', 'wp-asciiplayer' ) } aria-expanded={ isOpen } onClick={ onToggle } />
) } renderContent={ ( { onClose } ) => (
<div className="asciiplayer-terminal-popover__content" role="dialog" aria-label={ __( 'Terminal size', 'wp-asciiplayer' ) }>
<p><strong>{ __( 'Terminal size (columns × rows)', 'wp-asciiplayer' ) }</strong></p>
<TerminalSizeControls attributes={ attributes } setAttributes={ setAttributes } recordingSize={ recordingSize } />
<Button variant="tertiary" onClick={ onClose }>{ __( 'Close', 'wp-asciiplayer' ) }</Button>
</div>
) } />
</ToolbarGroup>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Terminal size', 'wp-asciiplayer' ) } initialOpen={ false }>
<TerminalSizeControls attributes={ attributes } setAttributes={ setAttributes } recordingSize={ recordingSize } />
</PanelBody>
<PanelBody title={ __( 'Display', 'wp-asciiplayer' ) }>
<SelectControl label={ __( 'Player width', 'wp-asciiplayer' ) } value={ customWidth || ! widthPresets.includes( width ) ? 'custom' : width } options={ widthOptions } onChange={ ( value ) => { setCustomWidth( value === 'custom' ); if ( value !== 'custom' ) setAttributes( { width: value } ); } } />
{ ( customWidth || ! widthPresets.includes( width ) ) && <TextControl label={ __( 'Custom width', 'wp-asciiplayer' ) } value={ draftWidth } help={ widthValid ? __( 'Use a CSS length, such as 480px or 65%. The player stays within its available space.', 'wp-asciiplayer' ) : __( 'Enter a positive width with a unit, such as 480px or 65%. The last valid width is kept.', 'wp-asciiplayer' ) } aria-invalid={ ! widthValid } onChange={ ( value ) => { setDraftWidth( value ); if ( value.trim() && normalizeWidth( value ) === value.trim() && parseFloat( value ) > 0 ) setAttributes( { width: value.trim() } ); } } /> }
<SelectControl label={ __( 'Display alignment', 'wp-asciiplayer' ) } value={ placement } options={ [ { label: __( 'Left', 'wp-asciiplayer' ), value: 'left' }, { label: __( 'Center', 'wp-asciiplayer' ), value: 'center' }, { label: __( 'Right', 'wp-asciiplayer' ), value: 'right' } ] } onChange={ ( value ) => setAttributes( { displayAlign: value } ) } />
<p>{ __( 'Display width scales the recording without changing its terminal columns or rows. Add a caption directly below the player.', 'wp-asciiplayer' ) }</p>
</PanelBody>
<PanelBody title={ __( 'Playback', 'wp-asciiplayer' ) }>
<RangeControl label={ __( 'Playback speed', 'wp-asciiplayer' ) } value={ speed } min={ 0.25 } max={ Math.max( 8, speed ) } step={ 0.25 } onChange={ ( value ) => setAttributes( { speed: finiteNumber( value, 1, 0.01, 100 ) } ) } />
<ToggleControl label={ __( 'Loop playback', 'wp-asciiplayer' ) } checked={ loop } onChange={ ( value ) => setAttributes( { loop: value } ) } />
<ToggleControl label={ __( 'Autoplay on published page', 'wp-asciiplayer' ) } help={ __( 'The editor preview always waits for you to press play.', 'wp-asciiplayer' ) } checked={ autoPlay } onChange={ ( value ) => setAttributes( { autoPlay: value } ) } />
<ToggleControl label={ __( 'Preload on published page', 'wp-asciiplayer' ) } help={ __( 'Loads the recording before the visitor presses play. The editor preview always preloads a valid recording URL.', 'wp-asciiplayer' ) } checked={ preload } onChange={ ( value ) => setAttributes( { preload: value } ) } />
<TextControl label={ __( 'Start at (seconds)', 'wp-asciiplayer' ) } type="number" min="0" step="0.1" value={ startAt } onChange={ ( value ) => setAttributes( { startAt: finiteNumber( value, 0 ) } ) } />
<TextControl label={ __( 'Idle time limit (seconds)', 'wp-asciiplayer' ) } help={ __( 'Shorten long pauses. Use 0 to keep the recording’s default.', 'wp-asciiplayer' ) } type="number" min="0" step="0.1" value={ idleTimeLimit } onChange={ ( value ) => setAttributes( { idleTimeLimit: finiteNumber( value, 0 ) } ) } />
</PanelBody>
<PanelBody title={ __( 'Appearance', 'wp-asciiplayer' ) }>
<SelectControl label={ __( 'Theme', 'wp-asciiplayer' ) } value={ theme } options={ themes } onChange={ ( value ) => setAttributes( { theme: value } ) } />
<SelectControl label={ __( 'Player controls', 'wp-asciiplayer' ) } value={ controls } options={ [
{ label: __( 'Show on interaction', 'wp-asciiplayer' ), value: 'auto' },
{ label: __( 'Always show', 'wp-asciiplayer' ), value: 'always' },
{ label: __( 'Hide', 'wp-asciiplayer' ), value: 'never' },
] } onChange={ ( value ) => setAttributes( { controls: value } ) } />
<SelectControl label={ __( 'Fit', 'wp-asciiplayer' ) } value={ fit } options={ fitOptions } help={ [ 'height', 'both' ].includes( fit ) ? __( 'Height-based fitting requires a fixed container height in your site CSS.', 'wp-asciiplayer' ) : undefined } onChange={ ( value ) => setAttributes( { fit: value } ) } />
{ attributes.legacyStyle && <p>{ __( 'The custom container style from your shortcode is preserved on the published page.', 'wp-asciiplayer' ) }</p> }
</PanelBody>
<PanelBody title={ __( 'Help', 'wp-asciiplayer' ) } initialOpen={ false }>
<p className="asciiplayer-editor__privacy">{ __( 'A valid recording URL loads its preview automatically, including when reopening this editor. That server receives your browser’s request. Published players contact the same server. Use a direct .cast URL; external servers must allow CORS.', 'wp-asciiplayer' ) }</p>
<p className="asciiplayer-editor__hint">{ __( 'Use the player controls to play, pause, and seek. Autoplay is disabled only in the editor.', 'wp-asciiplayer' ) }</p>
</PanelBody>
</InspectorControls>
<div { ...blockProps }>
<div className="asciiplayer-editor__source">
<form onSubmit={ applySource }>
<TextControl label={ __( 'Recording URL', 'wp-asciiplayer' ) } placeholder="https://example.com/recording.cast" value={ draftSource } onChange={ ( value ) => { setDraftSource( value ); setUrlError( false ); setMediaError( false ); } } autoComplete="off" />
<Button type="submit" variant="primary">{ __( 'Apply URL', 'wp-asciiplayer' ) }</Button>
</form>
<MediaUploadCheck>
<MediaUpload title={ __( 'Choose an Asciicast recording', 'wp-asciiplayer' ) } allowedTypes={ [ 'application/x-asciicast', 'text/plain', 'application/json', 'application/octet-stream', 'application/jsonl', 'application/x-ndjson' ] } multiple={ false } onSelect={ selectRecording } render={ ( { open } ) => (
<Button className="asciiplayer-editor__media" variant="secondary" onClick={ open }>{ __( 'Choose recording', 'wp-asciiplayer' ) }</Button>
) } />
</MediaUploadCheck>
{ mediaError && <Notice status="error" isDismissible={ false }>{ __( 'Choose an Asciicast (.cast) file from the Media Library.', 'wp-asciiplayer' ) }</Notice> }
{ urlError && <Notice status="error" isDismissible={ false }>{ __( 'Enter an HTTP(S) recording URL or a path starting with a single /.', 'wp-asciiplayer' ) }</Notice> }
</div>
<figure className={ `asciiplayer-figure asciiplayer-align-${ placement }` } style={ { width: normalizeWidth( width ) } }>
{ showPreview ? (
<>
<Preview source={ previewSource } attributes={ attributes } attempt={ attempt } onRecordingSize={ onRecordingSize } onRetry={ () => setAttempt( ( current ) => current + 1 ) } />
</>
) : (
<Placeholder icon="editor-code" label={ __( 'Asciicast Player', 'wp-asciiplayer' ) } instructions={ __( 'Enter a recording URL to load its preview automatically. Playback starts only when you press play.', 'wp-asciiplayer' ) } />
) }
<RichText tagName="figcaption" className={ `wp-element-caption${ ! isSelected && ! caption ? ' asciiplayer-caption-empty' : '' }` } value={ caption } allowedFormats={ [] } onChange={ ( value ) => setAttributes( { caption: value } ) } placeholder={ __( 'Add a caption…', 'wp-asciiplayer' ) } aria-label={ __( 'Recording caption', 'wp-asciiplayer' ) } />
</figure>
{ [ 'height', 'both' ].includes( fit ) && <p className="asciiplayer-editor__hint">{ __( 'Height-based previews use the shortcode’s fixed height when available, or a 320px editor frame. Published height still comes from your container style.', 'wp-asciiplayer' ) }</p> }
</div>
</>
);
}
+75
View File
@@ -0,0 +1,75 @@
.asciiplayer-editor {
box-sizing: border-box;
border: 1px solid #ddd;
border-radius: 4px;
padding: 16px;
}
.asciiplayer-editor__source form {
display: flex;
align-items: flex-end;
gap: 12px;
}
.asciiplayer-editor__source .components-base-control {
flex: 1;
margin-bottom: 0;
}
.asciiplayer-editor__source .components-base-control__field {
margin-bottom: 0;
}
.asciiplayer-editor__privacy,
.asciiplayer-editor__hint {
font-size: 12px;
line-height: 1.5;
color: #50575e;
}
.asciiplayer-editor__preview {
margin-top: 16px;
}
/*! rtl:begin:ignore */
.asciiplayer-editor__player {
min-width: 0;
text-align: left;
}
/*! rtl:end:ignore */
.asciiplayer-editor__status {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
}
@media (max-width: 480px) {
.asciiplayer-editor__source form {
align-items: stretch;
flex-direction: column;
}
}
.asciiplayer-editor > .asciiplayer-figure { margin-top: 16px; }
.asciiplayer-editor .asciiplayer-editor__preview { margin-top: 0; }
.asciiplayer-example { margin: 0; background: #121314; color: #eee; border-radius: 5px; overflow: hidden; }
.asciiplayer-example__terminal { padding: 24px 16px; font: 14px/1.7 monospace; white-space: pre; }
.asciiplayer-example__terminal > span:first-child { color: #a9da76; }
.asciiplayer-example__controls { padding: 8px 16px; background: #222; font: 12px/1.5 monospace; }
.asciiplayer-example figcaption { padding: 8px; background: #fff; color: #333; text-align: center; font-size: 12px; }
/* Keep an empty caption's footprint stable when another block is selected.
* Removing it on pointerdown can move the next block's button before pointerup. */
.asciiplayer-editor .asciiplayer-figure > figcaption { min-height: 1.5em; }
.asciiplayer-editor .asciiplayer-caption-empty { visibility: hidden; }
.asciiplayer-editor__dimension-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.asciiplayer-editor__dimension-fields input { max-width: 100%; }
.asciiplayer-terminal-popover__content { box-sizing: border-box; width: 300px; max-width: calc(100vw - 32px); padding: 16px; }
.asciiplayer-terminal-popover__content > p:first-child { margin-top: 0; }
.asciiplayer-terminal-popover__content > .components-button { margin-top: 8px; margin-right: 8px; }
.asciiplayer-editor__source .asciiplayer-editor__media { margin-top: 12px; }
+46
View File
@@ -0,0 +1,46 @@
import { createBlock, registerBlockType } from '@wordpress/blocks';
import { next } from '@wordpress/shortcode';
import { decodeEntities } from '@wordpress/html-entities';
import metadata from '../block.json';
import { _x } from '@wordpress/i18n';
import Edit from './edit.js';
import { attributesFromShortcode, canTransformShortcode, normalizeSource } from './options.js';
import './style.css';
import './editor.css';
function matchShortcodeBlock( text = '' ) {
const match = next( 'asciiplayer', text );
return match && text.trim() === match.content.trim() && canTransformShortcode( match.shortcode.attrs ) && normalizeSource( decodeEntities( match.shortcode.content ) ) ? match : null;
}
registerBlockType( metadata.name, {
...metadata,
title: _x( 'Asciicast Player', 'block title', 'wp-asciiplayer' ),
description: _x( 'Embed and preview a terminal recording with the locally bundled asciinema player.', 'block description', 'wp-asciiplayer' ),
keywords: [ _x( 'asciinema', 'block keyword', 'wp-asciiplayer' ), _x( 'terminal', 'block keyword', 'wp-asciiplayer' ), _x( 'recording', 'block keyword', 'wp-asciiplayer' ) ],
edit: Edit,
save: () => null,
transforms: {
from: [
{
type: 'shortcode',
tag: 'asciiplayer',
isMatch: canTransformShortcode,
transform: ( { named }, match ) => {
const source = decodeEntities( match.shortcode.content || '' );
if ( ! normalizeSource( source ) ) return createBlock( 'core/shortcode', { text: match.content } );
return createBlock( metadata.name, attributesFromShortcode( named, source ) );
},
},
{
type: 'block',
blocks: [ 'core/shortcode' ],
isMatch: ( { text } ) => Boolean( matchShortcodeBlock( text ) ),
transform: ( { text } ) => {
const match = matchShortcodeBlock( text );
return createBlock( metadata.name, attributesFromShortcode( match.shortcode.attrs.named, decodeEntities( match.shortcode.content ) ) );
},
},
],
},
} );
+149
View File
@@ -0,0 +1,149 @@
/** Shared, side-effect-free validation for the editor and front-end adapter. */
export const DEFAULTS = Object.freeze( {
theme: 'asciinema', speed: 1, loop: false, controls: 'auto', fit: 'width',
startAt: 0, idleTimeLimit: 0, autoPlay: false, preload: true, width: '100%',
} );
export function booleanValue( value, fallback = false ) {
if ( typeof value === 'boolean' ) return value;
if ( value === 1 || /^(true|1|yes|on)$/i.test( String( value ).trim() ) ) return true;
if ( value === 0 || /^(false|0|no|off)$/i.test( String( value ).trim() ) ) return false;
return fallback;
}
export function finiteNumber( value, fallback, min = 0, max = Number.MAX_SAFE_INTEGER ) {
if ( typeof value !== 'number' && typeof value !== 'string' ) return fallback;
if ( typeof value === 'string' && ! /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test( value.trim() ) ) return fallback;
const number = Number( value );
return Number.isFinite( number ) && number >= min && number <= max ? number : fallback;
}
/** Accept explicit web URLs and site-root-relative URLs; never executable schemes. */
export function normalizeSource( input ) {
if ( typeof input !== 'string' ) return '';
const source = input.trim();
if ( ! source || /[\u0000-\u0020\u007f<>"\\]/.test( source ) ) return '';
if ( /^\/(?!\/)/.test( source ) ) return source;
// URL() repairs missing/extra authority slashes; PHP deliberately does not.
if ( ! /^https?:\/\/[^/]/i.test( source ) ) return '';
try {
const url = new URL( source );
return [ 'http:', 'https:' ].includes( url.protocol ) && ! url.username && ! url.password ? source : '';
} catch {
return '';
}
}
export function normalizeWidth( value ) {
return typeof value === 'string' && /^(?:0|(?:\d+(?:\.\d+)?|\.\d+)(?:px|%|em|rem|vw|vh|vmin|vmax|ch))$/.test( value.trim() )
? value.trim() : DEFAULTS.width;
}
/** Presentation placement never changes the terminal's character grid. */
export function normalizeDisplayAlign( value ) {
return [ 'left', 'center', 'right' ].includes( value ) ? value : 'center';
}
export function terminalDimension( value ) {
const number = finiteNumber( value, 0, 1, 1000 );
return Number.isInteger( number ) && number > 0 ? number : undefined;
}
/** A bounded editor frame for old height-fitting shortcodes; never persisted. */
export function previewHeight( attributes ) {
if ( ! [ 'height', 'both' ].includes( attributes.fit ) ) return undefined;
let height = '320px';
for ( const declaration of String( attributes.legacyStyle || '' ).split( ';' ) ) {
const match = declaration.match( /^\s*height\s*:\s*((?:\d+(?:\.\d+)?|\.\d+)(?:px|em|rem|vh|vw|vmin|vmax|ch))\s*$/i );
if ( match ) height = match[ 1 ];
}
return height;
}
export function normalizeControls( value ) {
if ( typeof value === 'string' ) value = value.trim().toLowerCase();
if ( value === 'always' || booleanValue( value, null ) === true ) return true;
if ( value === 'never' || booleanValue( value, null ) === false ) return false;
return 'auto';
}
export function secondsValue( value ) {
if ( typeof value === 'string' && /^\d+(?::[0-5]?\d){1,2}(?:\.\d+)?$/.test( value.trim() ) ) {
return value.trim().split( ':' ).reduce( ( total, part ) => total * 60 + Number( part ), 0 );
}
return finiteNumber( value, 0 );
}
export function normalizePlayerOptions( attributes = {}, { preview = false } = {} ) {
const fit = typeof attributes.fit === 'string' ? attributes.fit.trim().toLowerCase() : attributes.fit;
const fontSize = typeof attributes.terminalFontSize === 'string' ? attributes.terminalFontSize.trim().toLowerCase() : '';
const fontFamily = typeof attributes.terminalFontFamily === 'string' ? attributes.terminalFontFamily.trim() : '';
const options = {
theme: typeof attributes.theme === 'string' && /^(?:auto\/)?[\w-]{1,64}$/.test( attributes.theme ) ? attributes.theme : DEFAULTS.theme,
speed: finiteNumber( attributes.speed, 1, 0.01, 100 ),
loop: booleanValue( attributes.loop ),
controls: normalizeControls( attributes.controls ),
fit: [ 'width', 'height', 'both', 'none' ].includes( fit ) ? fit : booleanValue( fit, null ) === false ? 'none' : 'width',
startAt: secondsValue( attributes.startAt ),
autoPlay: preview ? false : booleanValue( attributes.autoPlay ?? attributes.autoplay ),
preload: preview ? true : booleanValue( attributes.preload, true ),
};
// Shortcodes may intentionally request a finite number of loops.
if ( typeof attributes.loop === 'number' && attributes.loop > 0 && Number.isInteger( attributes.loop ) ) options.loop = attributes.loop;
const idle = finiteNumber( attributes.idleTimeLimit, 0 );
if ( idle > 0 ) options.idleTimeLimit = idle;
for ( const key of [ 'cols', 'rows' ] ) {
const number = finiteNumber( attributes[ key ], 0, 1, 1000 );
if ( Number.isInteger( number ) && number > 0 ) options[ key ] = number;
}
const lineHeight = finiteNumber( attributes.terminalLineHeight, 0, 0.1, 10 );
if ( lineHeight ) options.terminalLineHeight = lineHeight;
if ( fontFamily.length <= 300 && /^[a-zA-Z0-9 _.,'"-]+$/.test( fontFamily ) ) options.terminalFontFamily = fontFamily;
if ( /^(small|medium|big|0|(?:\d+(?:\.\d+)?|\.\d+)(?:px|%|em|rem|vw|vh|vmin|vmax|ch))$/.test( fontSize ) ) options.terminalFontSize = fontSize;
if ( typeof attributes.poster === 'string' && attributes.poster.length <= 32768 && /^(npt:\d+(?::[0-5]?\d){0,2}(?:\.\d+)?|data:text\/plain,[\s\S]*)$/.test( attributes.poster ) ) options.poster = attributes.poster;
return options;
}
const SHORTCODE_KEYS = {
theme: 'theme', speed: 'speed', loop: 'loop', controls: 'controls', fit: 'fit',
startat: 'startAt', idletimelimit: 'idleTimeLimit', autoplay: 'autoPlay', preload: 'preload',
cols: 'cols', rows: 'rows', terminalfontfamily: 'terminalFontFamily',
terminalfontsize: 'terminalFontSize', terminallineheight: 'terminalLineHeight', poster: 'poster', style: 'legacyStyle',
fontsize: 'terminalFontSize', fontfamily: 'terminalFontFamily', lineheight: 'terminalLineHeight', width: 'width',
};
/** Unknown legacy options stay in their original shortcode rather than being lost. */
export function canTransformShortcode( { named = {}, numeric = [] } = {} ) {
return numeric.length === 0 && Object.entries( named ).every( ( [ key, value ] ) => {
const lower = key.toLowerCase();
if ( ! Object.prototype.hasOwnProperty.call( SHORTCODE_KEYS, lower ) ) return false;
if ( lower === 'loop' && booleanValue( value, null ) === null ) return false;
if ( lower === 'style' ) {
const widths = String( value ).matchAll( /(?:^|;)\s*width\s*:\s*([^;]+)/gi );
for ( const match of widths ) if ( normalizeWidth( match[ 1 ] ) !== match[ 1 ].trim() ) return false;
}
return true;
} );
}
export function attributesFromShortcode( named = {}, content = '' ) {
const values = {};
for ( const [ key, value ] of Object.entries( named ) ) {
const target = SHORTCODE_KEYS[ key.toLowerCase() ];
if ( target ) values[ target ] = value;
}
if ( values.fit === 'false' || values.fit === false ) values.fit = 'none';
const normalized = normalizePlayerOptions( values );
const attributes = {
...normalized,
source: normalizeSource( content ),
controls: normalized.controls === true ? 'always' : normalized.controls === false ? 'never' : 'auto',
idleTimeLimit: normalized.idleTimeLimit ?? 0,
};
if ( values.legacyStyle ) {
attributes.legacyStyle = values.legacyStyle;
for ( const match of String( values.legacyStyle ).matchAll( /(?:^|;)\s*width\s*:\s*([^;]+)/gi ) ) attributes.width = normalizeWidth( match[ 1 ] );
}
if ( values.width ) attributes.width = normalizeWidth( values.width );
return attributes;
}
+103
View File
@@ -0,0 +1,103 @@
/**
* asciinema uses realm-global document/HTMLButtonElement internally. Execute its
* bundled script in the canvas document, not in the parent React document.
*/
const pendingDocuments = new WeakMap();
const pendingStyles = new WeakMap();
function findAsset( document, selector, property ) {
return document.querySelector( selector )?.[ property ];
}
export function playerAssets( hostWindow = window ) {
const settings = hostWindow.wpAsciiplayerSettings || {};
return {
script: settings.playerScriptUrl || findAsset( hostWindow.document, '#lamgc-asciiplayer-player-js', 'src' ),
style: settings.playerStyleUrl || findAsset( hostWindow.document, '#lamgc-asciiplayer-player-style-css', 'href' ),
};
}
function ensureStyle( document, url ) {
if ( ! url ) return Promise.reject( new Error( 'The local player stylesheet is unavailable.' ) );
let link = Array.from( document.querySelectorAll( 'link[rel="stylesheet"]' ) ).find( ( item ) => item.href === url && ( item.sheet || ! item.dataset.asciiplayerFailed ) );
if ( link?.sheet ) return Promise.resolve();
if ( pendingStyles.has( document ) ) return pendingStyles.get( document );
const created = ! link;
if ( created ) {
link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.href = url;
link.dataset.asciiplayerAsset = 'style';
}
const promise = new Promise( ( resolve, reject ) => {
let timer;
const cleanup = () => {
document.defaultView.clearTimeout( timer );
link.removeEventListener( 'load', loaded );
link.removeEventListener( 'error', failed );
};
const loaded = () => { cleanup(); resolve(); };
const failed = () => {
cleanup();
link.dataset.asciiplayerFailed = 'true';
if ( created ) link.remove();
reject( new Error( 'The local player stylesheet could not be loaded.' ) );
};
link.addEventListener( 'load', loaded );
link.addEventListener( 'error', failed );
timer = document.defaultView.setTimeout( failed, 20000 );
if ( created ) document.head.appendChild( link );
if ( link.sheet ) loaded();
} );
pendingStyles.set( document, promise );
promise.then( () => pendingStyles.delete( document ), () => pendingStyles.delete( document ) );
return promise;
}
export async function playerForDocument( document, assets ) {
const canvasWindow = document.defaultView;
if ( ! canvasWindow ) return Promise.reject( new Error( 'The editor canvas is unavailable.' ) );
// Player metrics are measured at create(), so CSS must finish first.
await ensureStyle( document, assets.style );
if ( typeof canvasWindow.AsciinemaPlayer?.create === 'function' ) return Promise.resolve( canvasWindow.AsciinemaPlayer );
if ( pendingDocuments.has( document ) ) return pendingDocuments.get( document );
if ( ! assets.script ) return Promise.reject( new Error( 'The local player script is unavailable.' ) );
const pending = new Promise( ( resolve, reject ) => {
let script = Array.from( document.scripts ).find( ( item ) => item.src === assets.script && ! item.dataset.asciiplayerFailed );
const created = ! script;
if ( created ) {
script = document.createElement( 'script' );
script.src = assets.script;
script.async = true;
script.dataset.asciiplayerAsset = 'script';
}
let timer;
const cleanup = () => {
canvasWindow.clearTimeout( timer );
script.removeEventListener( 'load', loaded );
script.removeEventListener( 'error', failed );
};
const failed = () => {
cleanup();
script.dataset.asciiplayerFailed = 'true';
// Only remove a script we own. A retry can then load a fresh copy.
if ( created ) script.remove();
reject( new Error( 'The local player script could not be loaded.' ) );
};
const loaded = () => {
if ( typeof canvasWindow.AsciinemaPlayer?.create !== 'function' ) return failed();
cleanup();
resolve( canvasWindow.AsciinemaPlayer );
};
script.addEventListener( 'load', loaded );
script.addEventListener( 'error', failed );
timer = canvasWindow.setTimeout( failed, 20000 );
if ( created ) document.head.appendChild( script );
// Covers a script that finished between the global check and listener setup.
if ( typeof canvasWindow.AsciinemaPlayer?.create === 'function' ) loaded();
} );
pendingDocuments.set( document, pending );
pending.catch( () => pendingDocuments.delete( document ) );
return pending;
}
+88
View File
@@ -0,0 +1,88 @@
import { Button, Notice, Spinner } from '@wordpress/components';
import { useRefEffect } from '@wordpress/compose';
import { useRef, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { normalizePlayerOptions, previewHeight } from './options.js';
import { playerAssets, playerForDocument } from './player-bridge.js';
import { readRecordingSize } from './recording-metadata.js';
export default function Preview( { source, attributes, attempt, onRetry, onRecordingSize } ) {
const [ status, setStatus ] = useState( 'loading' );
const [ problem, setProblem ] = useState( '' );
const onRecordingSizeRef = useRef( onRecordingSize );
onRecordingSizeRef.current = onRecordingSize;
const optionsJSON = JSON.stringify( normalizePlayerOptions( attributes, { preview: true } ) );
const playerRef = useRefEffect( ( container ) => {
let disposed = false;
let failed = false;
let player;
let readinessTimer;
let deadline;
const canvasWindow = container.ownerDocument.defaultView;
const request = new canvasWindow.AbortController();
const reportSize = ( size ) => {
if ( ! disposed ) onRecordingSizeRef.current?.( source, size );
};
setStatus( 'loading' );
setProblem( '' );
reportSize( null );
const fail = ( message ) => {
if ( disposed || failed ) return;
failed = true;
request.abort();
canvasWindow.clearInterval( readinessTimer );
canvasWindow.clearTimeout( deadline );
reportSize( null );
setProblem( message );
setStatus( 'error' );
};
const ready = () => {
if ( disposed || failed ) return;
canvasWindow.clearInterval( readinessTimer );
canvasWindow.clearTimeout( deadline );
setStatus( 'ready' );
};
playerForDocument( container.ownerDocument, playerAssets() ).then( ( api ) => {
if ( disposed ) return;
player = api.create( {
data: async () => {
// The parser checks instanceof Response in the canvas realm.
// Reuse this one request for playback and original-size hints.
const response = await canvasWindow.fetch( source, { signal: request.signal } );
if ( ! response.ok ) throw new Error( `Recording request failed: ${ response.status }` );
readRecordingSize( response ).then( ( size ) => {
if ( ! failed ) reportSize( size );
} );
return response;
},
}, container, JSON.parse( optionsJSON ) );
player.addEventListener( 'error', () => fail( __( 'Unable to load the recording. Check the URL, file format, and the source server’s CORS permissions.', 'wp-asciiplayer' ) ) );
player.addEventListener( 'playing', ready );
// getDuration is public API; a mounted wrapper alone does not mean the
// recording loaded successfully. Works across supported player versions.
const checkReady = () => {
const duration = player.getDuration();
if ( typeof duration === 'number' && Number.isFinite( duration ) ) ready();
};
readinessTimer = canvasWindow.setInterval( checkReady, 150 );
deadline = canvasWindow.setTimeout( () => fail( __( 'The recording is taking too long to load. Check your connection and try again.', 'wp-asciiplayer' ) ), 30000 );
checkReady();
} ).catch( () => fail( __( 'The local player could not start. Try again, or check that the plugin’s built assets are installed.', 'wp-asciiplayer' ) ) );
return () => {
disposed = true;
request.abort();
canvasWindow.clearInterval( readinessTimer );
canvasWindow.clearTimeout( deadline );
if ( player ) player.dispose();
container.replaceChildren();
};
}, [ source, optionsJSON, attempt ] );
return (
<div className="asciiplayer-editor__preview" data-preview-status={ status }>
{ status === 'loading' && <div className="asciiplayer-editor__status" role="status"><Spinner />{ __( 'Loading recording…', 'wp-asciiplayer' ) }</div> }
{ status === 'error' && <Notice status="error" isDismissible={ false }><p>{ problem }</p><Button variant="secondary" onClick={ onRetry }>{ __( 'Retry preview', 'wp-asciiplayer' ) }</Button></Notice> }
<div className="asciiplayer-editor__player" style={ { height: previewHeight( attributes ) } } ref={ playerRef } aria-label={ __( 'Interactive terminal recording preview', 'wp-asciiplayer' ) } />
</div>
);
}
+114
View File
@@ -0,0 +1,114 @@
/** Only inspect a small prefix; metadata must never buffer a second full cast. */
export const MAX_HEADER_BYTES = 64 * 1024;
/** Original dimensions, without the player's fallback or editor overrides. */
export function recordingSizeFromHeader( header ) {
if ( ! header || typeof header !== 'object' || Array.isArray( header ) ) return null;
let cols;
let rows;
if ( header.version === 1 || header.version === 2 ) {
cols = header.width;
rows = header.height;
} else if ( header.version === 3 ) {
cols = header.term?.cols;
rows = header.term?.rows;
} else {
return null;
}
// These are display-only hints, so do not apply the editor override limit.
const valid = ( value ) => Number.isSafeInteger( value ) && value > 0;
return valid( cols ) && valid( rows ) ? { cols, rows } : null;
}
/**
* Read complete top-level JSON members, never regex-match nested fields/output.
* v1 is one large JSON object, often pretty-printed, so its dimensions can be
* returned before stdout. v2/v3 require their complete first header object.
*/
function createHeaderReader() {
let text = '';
let cursor = 0;
let memberStart;
let quoted = false;
let escaped = false;
let members = 0;
const stack = [];
const header = Object.create( null );
const unknown = { done: true, size: null };
return ( chunk ) => {
text += chunk;
for ( ; cursor < text.length; cursor++ ) {
const character = text[ cursor ];
if ( memberStart === undefined ) {
if ( /\s/.test( character ) ) continue;
if ( character !== '{' ) return unknown;
stack.push( '{' );
memberStart = cursor + 1;
continue;
}
if ( quoted ) {
if ( escaped ) escaped = false;
else if ( character === '\\' ) escaped = true;
else if ( character === '"' ) quoted = false;
continue;
}
if ( character === '"' ) {
quoted = true;
continue;
}
if ( character === '{' || character === '[' ) {
stack.push( character );
continue;
}
const closing = character === '}' || character === ']';
if ( closing && stack.at( -1 ) !== ( character === '}' ? '{' : '[' ) ) return unknown;
if ( stack.length === 1 && ( character === ',' || closing ) ) {
const member = text.slice( memberStart, cursor ).trim();
if ( ! member && ( members || ! closing ) ) return unknown;
try {
Object.assign( header, JSON.parse( `{${ member }}` ) );
} catch {
return unknown;
}
members++;
const size = recordingSizeFromHeader( header );
if ( closing || ( header.version === 1 && size ) ) return { done: true, size };
memberStart = cursor + 1;
}
if ( closing ) stack.pop();
}
return { done: false, size: null };
};
}
/**
* Inspect a clone of the player's existing response. The original response is
* untouched, and callers can pass it to the player while this branch is read.
* Missing streams, invalid/oversized headers and read failures stay unknown.
*/
export async function readRecordingSize( response ) {
let reader;
try {
if ( ! response.ok || ! response.body?.getReader ) return null;
reader = response.clone().body.getReader();
const decode = new TextDecoder( 'utf-8', { fatal: true } );
const readHeader = createHeaderReader();
let bytes = 0;
while ( bytes < MAX_HEADER_BYTES ) {
const { value, done } = await reader.read();
if ( done ) return readHeader( decode.decode() ).size;
const prefix = value.subarray( 0, MAX_HEADER_BYTES - bytes );
bytes += prefix.byteLength;
const result = readHeader( decode.decode( prefix, { stream: true } ) );
if ( result.done ) return result.size;
}
return null;
} catch {
return null;
} finally {
// A cloned Response tees the stream. Awaiting cancellation can wait for
// the player's other branch to finish, delaying metadata or deadlocking.
if ( reader ) reader.cancel().catch( () => {} );
}
}

Some files were not shown because too many files have changed in this diff Show More