ep_table_of_contents 0.4.9 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.cjs CHANGED
@@ -5,8 +5,30 @@ require('eslint-config-etherpad/patch/modern-module-resolution');
5
5
 
6
6
  module.exports = {
7
7
  root: true,
8
+ // `globalThis` is standard in every runtime this plugin targets (Node >= 22
9
+ // and all supported browsers), but it is not in the `env`s that
10
+ // eslint-config-etherpad selects.
11
+ globals: {globalThis: 'readonly'},
8
12
  extends: 'etherpad/plugin',
9
13
  ignorePatterns: [
10
14
  '/static/js/scrollTo.js',
11
15
  ],
16
+ overrides: [
17
+ {
18
+ // eslint-config-etherpad has no profile for Playwright specs: it lints
19
+ // `static/tests/**` as CommonJS mocha running under Node. These specs are
20
+ // ES modules that run in Playwright's runner, so give them their own
21
+ // parser options and globals.
22
+ files: ['static/tests/frontend-new/specs/**/*'],
23
+ parserOptions: {ecmaVersion: 'latest', sourceType: 'module'},
24
+ env: {browser: true, node: true},
25
+ globals: {$: 'readonly'},
26
+ rules: {
27
+ strict: ['error', 'never'],
28
+ 'n/no-missing-require': 'off',
29
+ 'n/no-unpublished-import': 'off',
30
+ 'mocha/no-exports': 'off',
31
+ },
32
+ },
33
+ ],
12
34
  };
@@ -18,7 +18,7 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  steps:
20
20
  - name: Checkout
21
- uses: actions/checkout@v6
21
+ uses: actions/checkout@v7
22
22
 
23
23
  - name: Automerge
24
24
  uses: "pascalgn/automerge-action@v0.16.4"
@@ -16,21 +16,21 @@ jobs:
16
16
  steps:
17
17
  -
18
18
  name: Install libreoffice
19
- uses: awalsh128/cache-apt-pkgs-action@v1.6.0
19
+ uses: awalsh128/cache-apt-pkgs-action@v1.6.3
20
20
  with:
21
21
  packages: libreoffice libreoffice-pdfimport
22
22
  version: 1.0
23
23
  -
24
24
  name: Install etherpad core
25
- uses: actions/checkout@v6
25
+ uses: actions/checkout@v7
26
26
  with:
27
27
  repository: ether/etherpad-lite
28
28
  path: etherpad-lite
29
- - uses: actions/setup-node@v6
29
+ - uses: actions/setup-node@v7
30
30
  name: Install Node.js
31
31
  with:
32
32
  node-version: 25
33
- - uses: pnpm/action-setup@v6
33
+ - uses: pnpm/action-setup@v6.1.0
34
34
  name: Install pnpm
35
35
  with:
36
36
  package_json_file: ./etherpad-lite/package.json
@@ -39,7 +39,7 @@ jobs:
39
39
  shell: bash
40
40
  run: |
41
41
  echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
42
- - uses: actions/cache@v5
42
+ - uses: actions/cache@v6
43
43
  name: Setup pnpm cache
44
44
  with:
45
45
  path: ${{ env.STORE_PATH }}
@@ -48,7 +48,7 @@ jobs:
48
48
  ${{ runner.os }}-pnpm-store-
49
49
  -
50
50
  name: Checkout plugin repository
51
- uses: actions/checkout@v6
51
+ uses: actions/checkout@v7
52
52
  with:
53
53
  path: plugin
54
54
  - name: Remove tests
@@ -24,18 +24,18 @@ jobs:
24
24
 
25
25
  steps:
26
26
  - name: Checkout
27
- uses: actions/checkout@v6
27
+ uses: actions/checkout@v7
28
28
 
29
29
  - name: Initialize CodeQL
30
- uses: github/codeql-action/init@v4
30
+ uses: github/codeql-action/init@v4.38.1
31
31
  with:
32
32
  languages: ${{ matrix.language }}
33
33
  queries: +security-and-quality
34
34
 
35
35
  - name: Autobuild
36
- uses: github/codeql-action/autobuild@v4
36
+ uses: github/codeql-action/autobuild@v4.38.1
37
37
 
38
38
  - name: Perform CodeQL Analysis
39
- uses: github/codeql-action/analyze@v4
39
+ uses: github/codeql-action/analyze@v4.38.1
40
40
  with:
41
41
  category: "/language:${{ matrix.language }}"
@@ -12,15 +12,15 @@ jobs:
12
12
  steps:
13
13
  -
14
14
  name: Check out Etherpad core
15
- uses: actions/checkout@v6
15
+ uses: actions/checkout@v7
16
16
  with:
17
17
  repository: ether/etherpad-lite
18
18
  path: etherpad-lite
19
- - uses: actions/setup-node@v6
19
+ - uses: actions/setup-node@v7
20
20
  name: Install Node.js
21
21
  with:
22
22
  node-version: 25
23
- - uses: pnpm/action-setup@v6
23
+ - uses: pnpm/action-setup@v6.1.0
24
24
  name: Install pnpm
25
25
  with:
26
26
  package_json_file: ./etherpad-lite/package.json
@@ -29,7 +29,7 @@ jobs:
29
29
  shell: bash
30
30
  run: |
31
31
  echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
32
- - uses: actions/cache@v5
32
+ - uses: actions/cache@v6
33
33
  name: Setup pnpm cache
34
34
  with:
35
35
  path: ${{ env.STORE_PATH }}
@@ -38,7 +38,7 @@ jobs:
38
38
  ${{ runner.os }}-pnpm-store-
39
39
  -
40
40
  name: Checkout plugin repository
41
- uses: actions/checkout@v6
41
+ uses: actions/checkout@v7
42
42
  with:
43
43
  path: plugin
44
44
  -
@@ -0,0 +1,39 @@
1
+ name: Lint
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ lint:
8
+ name: ESLint
9
+ runs-on: ubuntu-latest
10
+ # `eslint .` executes .eslintrc.cjs and every installed ESLint plugin, so
11
+ # don't hand it the caller's contents:write / id-token:write token.
12
+ permissions:
13
+ contents: read
14
+ steps:
15
+ - name: Check out plugin repository
16
+ uses: actions/checkout@v7
17
+ - uses: actions/setup-node@v7
18
+ name: Install Node.js
19
+ with:
20
+ node-version: 25
21
+ - uses: pnpm/action-setup@v6.1.0
22
+ name: Install pnpm
23
+ with:
24
+ version: 10
25
+ run_install: false
26
+ - name: Get pnpm store directory
27
+ shell: bash
28
+ run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
29
+ - uses: actions/cache@v6
30
+ name: Setup pnpm cache
31
+ with:
32
+ path: ${{ env.STORE_PATH }}
33
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34
+ restore-keys: |
35
+ ${{ runner.os }}-pnpm-store-
36
+ - name: Install dependencies
37
+ run: pnpm install --ignore-scripts
38
+ - name: Run ESLint
39
+ run: pnpm run lint
@@ -18,20 +18,24 @@ jobs:
18
18
  contents: write # for the atomic version-bump push (branch + tag)
19
19
  id-token: write # for npm OIDC trusted publishing
20
20
  steps:
21
- - uses: actions/setup-node@v6
21
+ - uses: actions/setup-node@v7
22
22
  with:
23
- # OIDC trusted publishing needs npm >= 11.5.1, which requires
24
- # Node >= 20.17.0. setup-node's `20` resolves to the latest
25
- # 20.x, which satisfies that.
26
- node-version: 25
23
+ # OIDC trusted publishing needs npm >= 11.5.1. Node 24 is an LTS
24
+ # line that every npm 11.x and 12.x supports; Node 25 is not —
25
+ # npm 12 requires ^22.22.2 || ^24.15.0 || >=26.0.0, so on Node 25
26
+ # the upgrade step below died with EBADENGINE and no plugin could
27
+ # publish.
28
+ node-version: 24
27
29
  registry-url: https://registry.npmjs.org/
30
+ # Pinned to a range rather than @latest: the next npm major dropping
31
+ # this Node line would silently break publishing fleet-wide again.
28
32
  - name: Upgrade npm to >=11.5.1 (required for trusted publishing)
29
- run: npm install -g npm@latest
33
+ run: npm install -g npm@^11.5.1
30
34
  - name: Check out Etherpad core
31
- uses: actions/checkout@v6
35
+ uses: actions/checkout@v7
32
36
  with:
33
37
  repository: ether/etherpad-lite
34
- - uses: pnpm/action-setup@v6
38
+ - uses: pnpm/action-setup@v6.1.0
35
39
  name: Install pnpm
36
40
  with:
37
41
  run_install: false
@@ -39,7 +43,7 @@ jobs:
39
43
  shell: bash
40
44
  run: |
41
45
  echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
42
- - uses: actions/cache@v5
46
+ - uses: actions/cache@v6
43
47
  name: Setup pnpm cache
44
48
  with:
45
49
  path: ${{ env.STORE_PATH }}
@@ -47,7 +51,7 @@ jobs:
47
51
  restore-keys: |
48
52
  ${{ runner.os }}-pnpm-store-
49
53
  -
50
- uses: actions/checkout@v6
54
+ uses: actions/checkout@v7
51
55
  with:
52
56
  fetch-depth: 0
53
57
  -
@@ -73,7 +77,7 @@ jobs:
73
77
  # `pnpm version patch` bumps package.json, makes a commit, and creates
74
78
  # a `v<new-version>` tag. Capture the new tag name from package.json
75
79
  # rather than parsing pnpm's output, which has historically varied.
76
- # Bump the patch component directly with Node. pnpm/action-setup@v6
80
+ # Bump the patch component directly with Node. pnpm/action-setup@v6.0.10
77
81
  # sometimes installs pnpm 11 pre-releases even when version: 10.x is
78
82
  # requested (pnpm/action-setup#225); those pre-releases either skip
79
83
  # the git commit/tag or reject --no-git-tag-version as unknown.
@@ -8,6 +8,9 @@ permissions:
8
8
  id-token: write
9
9
 
10
10
  jobs:
11
+ lint:
12
+ uses: ./.github/workflows/lint.yml
13
+ secrets: inherit
11
14
  backend:
12
15
  uses: ./.github/workflows/backend-tests.yml
13
16
  secrets: inherit
@@ -17,6 +20,7 @@ jobs:
17
20
  release:
18
21
  if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
19
22
  needs:
23
+ - lint
20
24
  - backend
21
25
  - frontend
22
26
  permissions:
package/locales/ja.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "@metadata": {
3
3
  "authors": [
4
- "MagicAho"
4
+ "MagicAho",
5
+ "Tensama0415"
5
6
  ]
6
7
  },
7
- "ep_table_of_contents.toc.title": "目次の表示"
8
+ "ep_table_of_contents.toc.title": "目次の表示",
9
+ "ep_table_of_contents.toc": "目次の表示"
8
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_table_of_contents",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "View a table of contents for your pad",
5
5
  "author": {
6
6
  "name": "John McLear",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "eslint": "^8.57.1",
33
- "eslint-config-etherpad": "^4.0.5",
34
- "typescript": "^6.0.3"
33
+ "eslint-config-etherpad": "^5.0.0",
34
+ "typescript": "~6.0.3"
35
35
  },
36
36
  "scripts": {
37
37
  "test": "node --test tests/*.test.js",
@@ -39,6 +39,6 @@
39
39
  "lint:fix": "eslint --fix ."
40
40
  },
41
41
  "engines": {
42
- "node": ">=18.0.0"
42
+ "node": ">=22.0.0"
43
43
  }
44
44
  }
@@ -0,0 +1,10 @@
1
+ # js-yaml and brace-expansion arrive only as transitive dev dependencies (via
2
+ # eslint and minimatch@3), so `pnpm update` cannot move them. The selectors are
3
+ # scoped to the affected major line: an unbounded range would drag minimatch@3
4
+ # onto brace-expansion 5.x and eslint onto js-yaml 5.x.
5
+ #
6
+ # pnpm 11 no longer reads `pnpm.overrides` from package.json — these must live
7
+ # here or the lockfile and the install disagree (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH).
8
+ overrides:
9
+ js-yaml@^4: '>=4.3.2 <5'
10
+ brace-expansion@^1: '>=1.1.16 <2'
package/static/js/toc.js CHANGED
@@ -162,7 +162,7 @@ const tableOfContents = globalThis.tableOfContents = {
162
162
  });
163
163
 
164
164
  $('.tocItem').removeClass('activeTOC');
165
- if (activeTocIndex === null) return;
165
+ if (activeTocIndex == null) return;
166
166
  $(`.tocItem[data-toc-index="${activeTocIndex}"]`).addClass('activeTOC');
167
167
  },
168
168
 
@@ -8,9 +8,10 @@ const tocPath = path.resolve(__dirname, '..', '..', '..', '..', 'static', 'js',
8
8
 
9
9
  describe(__filename, function () {
10
10
  let src;
11
- before(function () { src = fs.readFileSync(tocPath, 'utf8'); });
12
11
 
13
- it('update() debounces findTags() via setTimeout (#51)', function () {
12
+ before(async function () { src = fs.readFileSync(tocPath, 'utf8'); });
13
+
14
+ it('update() debounces findTags() via setTimeout (#51)', async function () {
14
15
  // findTags walks every heading and rebuilds the #tocItems list. On pads
15
16
  // with hundreds of headings, firing it on every keystroke was the
16
17
  // source of the 1-char-per-second typing seen in #51. The update path
@@ -73,7 +73,8 @@ test.describe('table of contents numbering', () => {
73
73
  const tocItems = page.locator('#tocItems .tocItem');
74
74
  for (let i = 0; i < headingCount; i++) {
75
75
  await applyHeading(page, i, 2);
76
- await expect(page.locator(`#tocItems .tocItem[title="Section ${i + 1}"]`)).toBeVisible({timeout: 15_000});
76
+ await expect(page.locator(`#tocItems .tocItem[title="Section ${i + 1}"]`))
77
+ .toBeVisible({timeout: 15000});
77
78
  }
78
79
 
79
80
  await expect(tocItems).toHaveCount(headingCount);
@@ -14,7 +14,7 @@ const loadTocHelpers = () => {
14
14
  URLSearchParams,
15
15
  globalThis: {},
16
16
  $: () => ({
17
- click() {},
17
+ click: () => {},
18
18
  }),
19
19
  };
20
20
  sandbox.globalThis = sandbox;