chore: rename vendor to third_party (#9021)

This PR renames `vendor` to `third_party` to better adhere to internal
codebase nomenclature.
This commit is contained in:
jrandolf 2022-09-28 15:23:37 +02:00 committed by GitHub
parent f8de7b1273
commit 2a21896cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 25 additions and 20 deletions

View File

@ -39,4 +39,4 @@ yarn-error.log*
# ESLint ignores.
assets/
vendor/
third_party/

View File

@ -103,7 +103,7 @@ module.exports = {
{
name: 'mitt',
message:
'Import Mitt from the vendored location: vendor/mitt/index.js',
'Import `mitt` from the vendored location: third_party/mitt/index.js',
},
],
},

View File

@ -101,7 +101,7 @@ The following is a description of the primary folders in Puppeteer:
- `utils/mochaRunner` - contains the source code for our test runner.
- `compat` - contains code separated by module import type. See [`compat/README.md`](https://github.com/puppeteer/puppeteer/blob/main/compat/README.md) for details.
- `test-d` contains type tests using [`tsd`](https://github.com/SamVerschueren/tsd).
- `vendor` contains all dependencies that we vendor into the final build. See the [`vendor/README.md`](https://github.com/puppeteer/puppeteer/blob/main/vendor/README.md) for details.
- `third_party` contains all dependencies that we vendor into the final build. See the [`third_party/README.md`](https://github.com/puppeteer/puppeteer/blob/main/third_party/README.md) for details.
### Shipping CJS and ESM bundles
@ -113,10 +113,10 @@ We compile into the `lib` directory which is what we publish on the npm reposito
lib
- cjs
- puppeteer <== the output of compiling `src/tsconfig.cjs.json`
- vendor <== the output of compiling `vendor/tsconfig.cjs.json`
- third_party <== the output of compiling `third_party/tsconfig.cjs.json`
- esm
- puppeteer <== the output of compiling `src/tsconfig.esm.json`
- vendor <== the output of compiling `vendor/tsconfig.esm.json`
- third_party <== the output of compiling `third_party/tsconfig.json`
```
### `tsconfig.json` for the tests
@ -184,7 +184,7 @@ A barrier for introducing new installation dependencies is especially high:
- **Do not add** installation dependency unless it's critical to project success.
There are additional considerations for dependencies that are environment agonistic. See the [`vendor/README.md`](https://github.com/puppeteer/puppeteer/blob/main/vendor/README.md) for details.
There are additional considerations for dependencies that are environment agonistic. See the [`third_party/README.md`](https://github.com/puppeteer/puppeteer/blob/main/third_party/README.md) for details.
## Running & Writing Tests

View File

@ -57,11 +57,11 @@
"check:protocol-revision": "tsx scripts/ensure-correct-devtools-protocol-package",
"check:pinned-deps": "tsx scripts/ensure-pinned-deps",
"build": "npm run build:prod",
"build:dev": "run-s generate:sources build:tsc:dev && run-p bundle:vendor generate:artifacts",
"build:prod": "run-s generate:sources build:tsc:prod && run-p bundle:vendor generate:artifacts",
"build:dev": "run-s generate:sources build:tsc:dev && run-p bundle:third_party generate:artifacts",
"build:prod": "run-s generate:sources build:tsc:prod && run-p bundle:third_party generate:artifacts",
"build:tsc:dev": "tsc -b test",
"build:tsc:prod": "tsc -b tsconfig.lib.json",
"bundle:vendor": "rollup --config rollup.vendor.config.js"
"bundle:third_party": "rollup --config rollup.third_party.config.js"
},
"files": [
"lib",

View File

@ -13,22 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import path from 'path';
import glob from 'glob';
import dts from 'rollup-plugin-dts';
import resolve from 'rollup-plugin-node-resolve';
import glob from 'glob';
export default ['cjs', 'esm'].flatMap(outputType => {
const configs = [];
const vendorPath = path.resolve(__dirname, `lib/${outputType}/vendor`);
for (const jsFile of glob.sync(path.join(vendorPath, '**/*.js'))) {
// Note we don't use path.join here. We cannot since `glob` does not support
// the backslash path separator.
const thirdPartyPath = `lib/${outputType}/third_party`;
for (const jsFile of glob.sync(`${thirdPartyPath}/**/*.js`)) {
configs.push({
input: jsFile,
output: {file: jsFile, exports: 'auto', format: outputType},
plugins: [resolve()],
});
}
for (const typesFile of glob.sync(path.join(vendorPath, '**/*.d.ts'))) {
for (const typesFile of glob.sync(`${thirdPartyPath}/**/*.d.ts`)) {
configs.push({
input: typesFile,
output: {file: typesFile, format: outputType},

View File

@ -14,7 +14,11 @@
* limitations under the License.
*/
import mitt, {Emitter, EventType, Handler} from '../../vendor/mitt/index.js';
import mitt, {
Emitter,
EventType,
Handler,
} from '../../third_party/mitt/index.js';
/**
* @public

View File

@ -7,6 +7,6 @@
},
"references": [
{"path": "../compat/cjs/tsconfig.json"},
{"path": "../vendor/tsconfig.json"}
{"path": "../third_party/tsconfig.json"}
]
}

View File

@ -7,6 +7,6 @@
},
"references": [
{"path": "../compat/esm/tsconfig.json"},
{"path": "../vendor/tsconfig.cjs.json"}
{"path": "../third_party/tsconfig.cjs.json"}
]
}

View File

@ -1,4 +1,4 @@
# `vendor`
# `third_party`
This folder contains code that interacts with third party node modules that will
be vendored with puppeteer during publishing.

View File

@ -3,7 +3,7 @@
"compilerOptions": {
"composite": true,
"declarationMap": false,
"outDir": "../lib/cjs/vendor",
"outDir": "../lib/cjs/third_party",
"sourceMap": false
}
}

View File

@ -3,7 +3,7 @@
"compilerOptions": {
"composite": true,
"declarationMap": false,
"outDir": "../lib/esm/vendor",
"outDir": "../lib/esm/third_party",
"sourceMap": false
}
}