Skip to content

Commit 2d1fbf3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 06e55fc + 1e07b87 commit 2d1fbf3

File tree

498 files changed

+52738
-36887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

498 files changed

+52738
-36887
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ docs/
44
node_modules/
55
external/bcmaps/
66
external/builder/fixtures/
7-
external/builder/fixtures_esprima/
7+
external/builder/fixtures_babel/
88
external/quickjs/
9+
external/openjpeg/
910
test/tmp/
1011
test/pdfs/
12+
web/locale/
1113
*~/

.eslintrc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
"plugins": [
88
"import",
99
"json",
10-
"mozilla",
1110
"no-unsanitized",
12-
"sort-exports",
11+
"perfectionist",
1312
"unicorn",
1413
],
1514

@@ -44,13 +43,10 @@
4443
"import/no-unresolved": ["error", {
4544
"ignore": ["display", "pdfjs", "pdfjs-lib", "pdfjs-web", "web", "fluent-bundle", "fluent-dom"],
4645
}],
47-
"mozilla/avoid-removeChild": "error",
48-
"mozilla/use-includes-instead-of-indexOf": "error",
4946
"no-unsanitized/method": "error",
5047
"no-unsanitized/property": "error",
51-
"sort-exports/sort-exports": ["error", {
52-
"ignoreCase": true,
53-
}],
48+
"perfectionist/sort-exports": "error",
49+
"perfectionist/sort-named-exports": "error",
5450
"unicorn/no-abusive-eslint-disable": "error",
5551
"unicorn/no-array-push-push": "error",
5652
"unicorn/no-instanceof-array": "error",
@@ -70,6 +66,7 @@
7066
"unicorn/prefer-date-now": "error",
7167
"unicorn/prefer-dom-node-append": "error",
7268
"unicorn/prefer-dom-node-remove": "error",
69+
"unicorn/prefer-includes": "error",
7370
"unicorn/prefer-logical-operator-over-ternary": "error",
7471
"unicorn/prefer-modern-dom-apis": "error",
7572
"unicorn/prefer-modern-math-apis": "error",
@@ -79,6 +76,7 @@
7976
"unicorn/prefer-string-replace-all": "error",
8077
"unicorn/prefer-string-starts-ends-with": "error",
8178
"unicorn/prefer-ternary": ["error", "only-single-line"],
79+
"unicorn/throw-new-error": "error",
8280

8381
// Possible errors
8482
"for-direction": "error",
@@ -142,9 +140,10 @@
142140
"no-lone-blocks": "error",
143141
"no-lonely-if": "error",
144142
"no-multi-str": "error",
143+
"no-new": "error",
145144
"no-new-func": "error",
145+
"no-new-symbol": "error",
146146
"no-new-wrappers": "error",
147-
"no-new": "error",
148147
"no-octal-escape": "error",
149148
"no-octal": "error",
150149
"no-redeclare": "error",
@@ -242,9 +241,9 @@
242241
}],
243242

244243
// ECMAScript 6
244+
"arrow-body-style": ["error", "as-needed"],
245245
"constructor-super": "error",
246246
"no-class-assign": "error",
247-
"no-confusing-arrow": "error",
248247
"no-const-assign": "error",
249248
"no-dupe-class-members": "error",
250249
"no-duplicate-imports": "error",
@@ -257,6 +256,7 @@
257256
"avoidQuotes": true,
258257
}],
259258
"prefer-const": "error",
259+
"require-yield": "error",
260260
"sort-imports": ["error", {
261261
"ignoreCase": true,
262262
}],

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Auto-format `.js` files with ESLint/Prettier
2+
de36b2aabab2b7fd647d9591f959c4540129541d
3+
# Auto-format `.css` files with Stylelint/Prettier
4+
8aa2718d225ad701a5b8a2788b42d221f1e4327d
5+
# Auto-format `.json` files with Prettier
6+
29de9bdce6c9785574994fda0e51533d796a9bb4

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Bug Report
2+
description: Report a bug in PDF.js
3+
title: "[Bug]: "
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Attach (recommended) or Link to PDF file
8+
description: Without this information the issue may be closed without comment
9+
placeholder: Please place only the PDF file in this field
10+
validations:
11+
required: true
12+
13+
- type: markdown
14+
attributes: { value: "---" }
15+
16+
- type: input
17+
attributes:
18+
label: Web browser and its version
19+
description: Please ensure that it's supported, refer to [the FAQ](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support)
20+
validations:
21+
required: true
22+
- type: input
23+
attributes:
24+
label: Operating system and its version
25+
validations:
26+
required: true
27+
- type: input
28+
attributes:
29+
label: PDF.js version
30+
description: Please find official releases [here](https://github.com/mozilla/pdf.js/releases)
31+
validations:
32+
required: true
33+
- type: dropdown
34+
attributes:
35+
label: Is the bug present in the latest PDF.js version?
36+
description: Please check the [online demo](https://github.com/mozilla/pdf.js#online-demo)
37+
options: ["Yes", "No"]
38+
default: 0
39+
validations:
40+
required: true
41+
- type: dropdown
42+
attributes:
43+
label: Is a browser extension
44+
options: ["Yes", "No"]
45+
default: 1
46+
validations:
47+
required: true
48+
49+
- type: markdown
50+
attributes: { value: "---" }
51+
52+
- type: textarea
53+
attributes:
54+
label: Steps to reproduce the problem
55+
placeholder: "1.\n2."
56+
validations:
57+
required: true
58+
59+
- type: textarea
60+
attributes:
61+
label: What is the expected behavior?
62+
description: Also add a screenshot
63+
validations:
64+
required: true
65+
66+
- type: textarea
67+
attributes:
68+
label: What went wrong?
69+
description: Also add a screenshot
70+
validations:
71+
required: true
72+
73+
- type: input
74+
attributes:
75+
label: Link to a viewer
76+
description: Needed if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension
77+
78+
- type: textarea
79+
attributes:
80+
label: Additional context
81+
description: Do you have anything to add that doesn't fit in the issue template?

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Need help?
4+
url: https://github.com/mozilla/pdf.js/discussions
5+
about: If you need help on how to use PDF.js, please open a discussion where other community members can reply

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Feature request
2+
description: Propose a new feature or enhancement for PDF.js
3+
title: "[Feature]: "
4+
body:
5+
- type: dropdown
6+
attributes:
7+
label: Is the feature relevant to the Firefox PDF Viewer?
8+
options: ["Yes", "No"]
9+
default: 1
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
attributes:
15+
label: Feature description
16+
description: What new feature would you like PDF.js to have? Why would it be useful? What are the current workarounds?
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
attributes:
22+
label: Other PDF viewers
23+
description: Do other PDF viewers implement similar functionality? Add descriptions, links, and/or screenshots.

.github/SECURITY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Security policy
2+
3+
Mozilla takes the security of our software seriously. If you believe you have found a security vulnerability in PDF.js, please report it to us as described below.
4+
5+
## Reporting security vulnerabilities
6+
7+
**Please don't report security vulnerabilities through public GitHub issues.**
8+
9+
Instead, please report security vulnerabilities in [Bugzilla](https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox&component=PDF%20Viewer&groups=firefox-core-security) and make sure that the checkbox in the "Security" section is checked so the required access controls are automatically configured:
10+
11+
![Security checkbox](https://github.com/mozilla/pdf.js/blob/master/.github/security.png)
12+
13+
The Mozilla security team will process the bug as described in [Mozilla's security bugs policy](https://www.mozilla.org/en-US/about/governance/policies/security-group/bugs).

.github/security.png

10.6 KB
Loading

.github/workflows/ci.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
node-version: [18, lts/*, latest]
14+
node-version: [18, lts/*, 22, 23]
1515

1616
steps:
1717
- name: Checkout repository
@@ -24,14 +24,11 @@ jobs:
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626

27-
- name: Install Gulp
28-
run: npm install -g gulp-cli
29-
30-
- name: Install other dependencies
31-
run: npm install
27+
- name: Install dependencies
28+
run: npm ci
3229

3330
- name: Run external tests
34-
run: gulp externaltest
31+
run: npx gulp externaltest
3532

3633
- name: Run CLI unit tests
37-
run: gulp unittestcli
34+
run: npx gulp unittestcli

.github/workflows/font_tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ jobs:
4545
with:
4646
node-version: ${{ matrix.node-version }}
4747

48-
- name: Install Gulp
49-
run: npm install -g gulp-cli
50-
51-
- name: Install other dependencies
52-
run: npm install
48+
- name: Install dependencies
49+
run: npm ci
5350

5451
- name: Use Python 3.12
5552
uses: actions/setup-python@v5
@@ -61,4 +58,4 @@ jobs:
6158
run: pip install fonttools
6259

6360
- name: Run font tests
64-
run: gulp fonttest --headless
61+
run: npx gulp fonttest --headless

.github/workflows/lint.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ jobs:
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626

27-
- name: Install Gulp
28-
run: npm install -g gulp-cli
29-
30-
- name: Install other dependencies
31-
run: npm install
27+
- name: Install dependencies
28+
run: npm ci
3229

3330
- name: Run lint
34-
run: gulp lint
31+
run: npx gulp lint
3532

3633
- name: Run lint-chromium
37-
run: gulp lint-chromium
34+
run: npx gulp lint-chromium

.github/workflows/publish_release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish release
2+
on:
3+
release:
4+
types: [published]
5+
permissions:
6+
contents: read
7+
id-token: write
8+
9+
jobs:
10+
publish:
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [lts/*]
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
registry-url: 'https://registry.npmjs.org'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build the `pdfjs-dist` library
34+
run: npx gulp dist
35+
36+
- name: Publish the `pdfjs-dist` library to NPM
37+
run: npm publish ./build/dist --provenance
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish_website.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ jobs:
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828

29-
- name: Install Gulp
30-
run: npm install -g gulp-cli
31-
32-
- name: Install other dependencies
33-
run: npm install
29+
- name: Install dependencies
30+
run: npm ci
3431

3532
- name: Build the website
36-
run: gulp web
33+
run: npx gulp web
3734

3835
- name: Archive the website
3936
shell: sh
@@ -52,7 +49,7 @@ jobs:
5249
INPUT_PATH: build/gh-pages
5350

5451
- name: Upload the website
55-
uses: actions/upload-artifact@v3
52+
uses: actions/upload-artifact@v4
5653
with:
5754
name: github-pages
5855
path: ${{ runner.temp }}/website.tar
@@ -69,4 +66,4 @@ jobs:
6966

7067
steps:
7168
- name: Deploy the website
72-
uses: actions/deploy-pages@v3
69+
uses: actions/deploy-pages@v4

.github/workflows/types_tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ jobs:
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626

27-
- name: Install Gulp
28-
run: npm install -g gulp-cli
29-
30-
- name: Install other dependencies
31-
run: npm install
27+
- name: Install dependencies
28+
run: npm ci
3229

3330
- name: Run types tests
34-
run: gulp typestest
31+
run: npx gulp typestest

0 commit comments

Comments
 (0)