Bug 1755599 - Add vendor configuration for @cfworker/json-schema r=mhoye,mossop

Differential Revision: https://phabricator.services.mozilla.com/D138923
This commit is contained in:
Barret Rennie 2022-03-10 18:53:31 +00:00
Родитель eb959d8afc
Коммит 0526a4c820
8 изменённых файлов: 199 добавлений и 1 удалений

21
third_party/js/cfworker/LICENSE.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Jeremy Danyow
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.

42
third_party/js/cfworker/build.sh поставляемый Normal file
Просмотреть файл

@ -0,0 +1,42 @@
#!/bin/sh
set -euo pipefail
# Path to mach relative to /third_party/js/cfworker
MACH=$(realpath "../../../mach")
if [[ $(uname -a) == *MSYS* ]]; then
MACH="python ${MACH}"
fi
NODE="${MACH} node"
NPM="${MACH} npm"
# Delete empty vestigial directories.
rm -rf .changeset/ .github/ .vscode/
# Patch typescript config to ensure we have LF endings.
patch tsconfig-base.json tsconfig-base.json.patch
cd packages/json-schema
# Install dependencies.
${NPM} install --also=dev
# Compile TypeScript into JavaScript.
${NPM} run build
# Install rollup and bundle into a single module.
${NPM} install rollup@~2.67.x
${NODE} node_modules/rollup/dist/bin/rollup \
dist/index.js \
--file json-schema.js \
--format cjs
cd ../..
# Patch the CommonJS module into a regular JS file and include a copyright notice.
patch packages/json-schema/json-schema.js json-schema.jsm.patch
awk -f exports.awk packages/json-schema/json-schema.js >json-schema.js
# Remove source files we no longer need.
rm -rf packages/ tsconfig-base.json

20
third_party/js/cfworker/exports.awk поставляемый Normal file
Просмотреть файл

@ -0,0 +1,20 @@
#!/bin/awk -f
BEGIN {
n_exports = 0;
}
{
if ($0 ~ /^exports.*=/) {
exports[n_exports] = substr($3, 0, length($3) - 1);
n_exports++;
} else {
print;
}
}
END {
for (i = 0; i < n_exports; i++) {
print "this." exports[i] " = " exports[i] ";";
}
}

31
third_party/js/cfworker/json-schema.jsm.patch поставляемый Normal file
Просмотреть файл

@ -0,0 +1,31 @@
--- json-schema.jsm
+++ json-schema.jsm
@@ -1,6 +1,26 @@
-'use strict';
+/*
+ * Copyright (c) 2020 Jeremy Danyow
+ *
+ * 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.
+ */
-Object.defineProperty(exports, '__esModule', { value: true });
+'use strict';
function deepCompareStrict(a, b) {
const typeofa = typeof a;

44
third_party/js/cfworker/moz.yaml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,44 @@
schema: 1
bugzilla:
product: Toolkit
component: General
origin:
name: "cfworker"
description: A JSON schema validator
url: https://github.com/cfworker/cfworker/tree/main/packages/json-schema
license: MIT
release: commit @cfworker/dev@1.13.2 (2022-01-23T22:05:24+00:00).
revision: "v1.10.1"
vendoring:
url: https://github.com/cfworker/cfworker
source-hosting: github
tracking: tag
skip-vendoring-steps: ["update-moz-build"]
keep:
- build.sh
- exports.awk
- json-schema.jsm.patch
- tsconfig-base.json.patch
exclude:
- "**"
- ".*"
- ".changeset"
- ".github"
- ".vscode"
include:
- LICENSE.md
- packages/json-schema/src
- packages/json-schema/package.json
- packages/json-schema/tsconfig.json
- tsconfig-base.json
update-actions:
- action: run-script
script: 'build.sh'
cwd: '{yaml_dir}'

9
third_party/js/cfworker/tsconfig-base.json.patch поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
--- tsconfig-base.json
+++ tsconfig-base.json
@@ -1,5 +1,6 @@
{
"compilerOptions": {
+ "newLine": "lf",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,

Просмотреть файл

@ -114,4 +114,5 @@ toolkit.jar:
content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
# Third party files
content/global/third_party/d3/d3.js (/third_party/js/d3/d3.js)
content/global/third_party/d3/d3.js (/third_party/js/d3/d3.js)
content/global/third_party/cfworker/json-schema.js (/third_party/js/cfworker/json-schema.js)

Просмотреть файл

@ -77,6 +77,7 @@
<li><a href="about:license#bspatch">bspatch License</a></li>
<li><a href="about:license#byteorder">byteorder License</a></li>
<li><a href="about:license#cairo">Cairo Component Licenses</a></li>
<li><a href="about:license#cfworker">cfworker License</a></li>
<li><a href="about:license#chromium">Chromium License</a></li>
<li><a href="about:license#codemirror">CodeMirror License</a></li>
<li><a href="about:license#cryptogams">CRYPTOGAMS License</a></li>
@ -2350,6 +2351,35 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
</pre>
<hr>
<h1><a id="cfworker"></a>cfworker License</h1>
<p>This license applies to the file <code>toolkit/content/third_party/cfworker/json-schema.js</code></p>
<pre>
MIT License
Copyright (c) 2020 Jeremy Danyow
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.
</pre>
<hr>
<h1><a id="chromium"></a>Chromium License</h1>