源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Dependency audit / audit (push) Canceled after 0s
CI / plan (push) Canceled after 0s
Gitoxide helper admission / macos-latest (push) Canceled after 0s
Gitoxide helper admission / ubuntu-latest (push) Canceled after 0s
Gitoxide helper admission / windows-latest (push) Canceled after 0s
Runtime Host peer admission / quality (push) Canceled after 0s
Windows recovery / windows_recovery (push) Canceled after 0s
CI / heavy (push) Canceled after 0s
CI / test (push) Canceled after 0s
Dependency audit / audit (push) Canceled after 0s
CI / plan (push) Canceled after 0s
Gitoxide helper admission / macos-latest (push) Canceled after 0s
Gitoxide helper admission / ubuntu-latest (push) Canceled after 0s
Gitoxide helper admission / windows-latest (push) Canceled after 0s
Runtime Host peer admission / quality (push) Canceled after 0s
Windows recovery / windows_recovery (push) Canceled after 0s
CI / heavy (push) Canceled after 0s
CI / test (push) Canceled after 0s
This commit is contained in:
commit
7be535059e
3358 files changed
+1306357
No files matched your search
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { test } from 'node:test';
|
||||
|
||||
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
|
||||
test('keeps a version-pinned Apache override scoped to the Apache license', () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
['scripts/generate-third-party-notices.mjs', '--check'],
|
||||
{
|
||||
cwd: root,
|
||||
encoding: 'utf8',
|
||||
},
|
||||
);
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
|
||||
const notices = readFileSync(
|
||||
join(root, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
|
||||
'utf8',
|
||||
);
|
||||
// Match the package without its version: the override is version-pinned in
|
||||
// the generator, but pinning the version here too would fail on every
|
||||
// routine dependency bump rather than on the leak this test guards.
|
||||
const providerUtils = notices
|
||||
.split('\n================================================================================\n')
|
||||
.find((section) => section.includes('Package: @ai-sdk/provider-utils@'));
|
||||
assert.ok(providerUtils, 'provider-utils notice section must exist');
|
||||
assert.doesNotMatch(providerUtils, /THIRD-PARTY COMPONENTS/);
|
||||
});
|
||||
|
||||
test('preserves exact README MIT notices for packages without license files', () => {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
['scripts/generate-third-party-notices.mjs', '--check'],
|
||||
{
|
||||
cwd: root,
|
||||
encoding: 'utf8',
|
||||
},
|
||||
);
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
|
||||
const notices = readFileSync(
|
||||
join(root, 'apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt'),
|
||||
'utf8',
|
||||
);
|
||||
const sections = notices.split(
|
||||
'\n================================================================================\n',
|
||||
);
|
||||
const fastdom = sections.find((section) => section.includes('Package: fastdom@1.0.12'));
|
||||
const strictdom = sections.find((section) => section.includes('Package: strictdom@1.0.1'));
|
||||
|
||||
assert.ok(fastdom, 'fastdom notice section must exist');
|
||||
assert.match(fastdom, /Copyright \(c\) 2016 Wilson Page <wilsonpage@me\.com>/);
|
||||
assert.match(fastdom, /associated documentation files \(the 'Software'\)/);
|
||||
assert.doesNotMatch(fastdom, /Kornel Lesinski/);
|
||||
|
||||
assert.ok(strictdom, 'strictdom notice section must exist');
|
||||
assert.match(strictdom, /Copyright \(c\) 2013 Wilson Page <wilsonpage@me\.com>/);
|
||||
assert.match(strictdom, /associated documentation files \(the 'Software'\)/);
|
||||
});
|
||||
Reference in new issue
Block a user