This is an automated email from the ASF dual-hosted git repository.
bobbai00 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 7ccc97a1d9 fix(dependencies): remove jschardet from the frontend
dependency graph (#4480)
7ccc97a1d9 is described below
commit 7ccc97a1d9459380ba437dd5f8130873ab10aaaf
Author: Xinyuan Lin <[email protected]>
AuthorDate: Wed Apr 22 22:18:43 2026 -0700
fix(dependencies): remove jschardet from the frontend dependency graph
(#4480)
### What changes were proposed in this PR?
Attempt to fix the PR #4475
### Any related issues, documentation, discussions?
Closes #4461
### How was this PR tested?
```
rm -rf frontend/node_modules
yarn --cwd frontend install
find frontend/node_modules -maxdepth 2 -name 'jschardet*' -type d
grep -c 'jschardet' frontend/yarn.lock
grep -B1 -A1 'jschardet' frontend/yarn.lock | head
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)
---------
Co-authored-by: Jiadong Bai <[email protected]>
---
frontend/.yarnrc.yml | 5 -----
frontend/package.json | 3 ++-
frontend/tools/jschardet-stub/index.js | 29 +++++++++++++++++++++++++++++
frontend/tools/jschardet-stub/package.json | 7 +++++++
frontend/yarn.lock | 9 ++++-----
5 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/frontend/.yarnrc.yml b/frontend/.yarnrc.yml
index a58134da75..3c08760b15 100644
--- a/frontend/.yarnrc.yml
+++ b/frontend/.yarnrc.yml
@@ -18,8 +18,3 @@
yarnPath: .yarn/releases/yarn-4.14.1.cjs
nodeLinker: node-modules
nmMode: hardlinks-local
-
-packageExtensions:
- "@codingame/monaco-vscode-api@*":
- dependencies:
- jschardet: null
diff --git a/frontend/package.json b/frontend/package.json
index a08ea29222..82af8203fd 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -89,7 +89,8 @@
"resolutions": {
"vscode": "npm:@codingame/[email protected]",
"monaco-editor": "npm:@codingame/[email protected]",
- "webpack": "5.89.0"
+ "webpack": "5.89.0",
+ "jschardet": "portal:./tools/jschardet-stub"
},
"devDependencies": {
"@angular-builders/custom-webpack": "18.0.0",
diff --git a/frontend/tools/jschardet-stub/index.js
b/frontend/tools/jschardet-stub/index.js
new file mode 100644
index 0000000000..0af1982368
--- /dev/null
+++ b/frontend/tools/jschardet-stub/index.js
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+// No-op replacement for the LGPL-2.1 `jschardet` package, which is
+// ASF Category X. Redirected here via `resolutions` in
+// frontend/package.json. The upstream call site lives in
+// @codingame/monaco-vscode-api's encoding service and is only reached
+// when opening binary files through Monaco, which Texera never does.
+
+module.exports = {
+ detect: () => null,
+};
+module.exports.default = module.exports;
diff --git a/frontend/tools/jschardet-stub/package.json
b/frontend/tools/jschardet-stub/package.json
new file mode 100644
index 0000000000..aa69357138
--- /dev/null
+++ b/frontend/tools/jschardet-stub/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "jschardet",
+ "version": "3.1.3",
+ "description": "Apache-2.0 no-op stub replacing upstream jschardet
(LGPL-2.1, ASF Category X).",
+ "license": "Apache-2.0",
+ "main": "index.js"
+}
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index bf112d70f6..32a2d85c25 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -14092,12 +14092,11 @@ __metadata:
languageName: node
linkType: hard
-"jschardet@npm:3.1.3":
- version: 3.1.3
- resolution: "jschardet@npm:3.1.3"
- checksum:
10c0/e6b9d61c313acd66531319116d176e3ca99b81b3a0e247cca47ce7817b99135c2c2c02787f449d557ba4ec98fab604f20a96402ebebab4bd1c8e992c5aad9c5a
+"jschardet@portal:./tools/jschardet-stub::locator=gui%40workspace%3A.":
+ version: 0.0.0-use.local
+ resolution:
"jschardet@portal:./tools/jschardet-stub::locator=gui%40workspace%3A."
languageName: node
- linkType: hard
+ linkType: soft
"jsdoc-type-pratt-parser@npm:~4.0.0":
version: 4.0.0