mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): vendor @mcp-b/webmcp-types
This copies WebMCP types into `@angular/core` and redistributes them. Ideally this would just be a regular dependency, but we need to do this vendoring for API extractor to properly process the types, since they will inform `@angular/core` public API. One downside of this approach is that the dependency is not visible in Intellisense, breaking type inference.
This commit is contained in:
committed by
Alex Rickabaugh
parent
043055f6de
commit
5387e13b10
@@ -1,9 +1,12 @@
|
||||
load("@npm//:defs.bzl", "npm_link_all_packages")
|
||||
load("//adev/shared-docs/pipeline/api-gen:generate_api_docs.bzl", "generate_api_docs")
|
||||
load("//packages/common/locales:index.bzl", "generate_base_locale_file")
|
||||
load("//tools:defaults.bzl", "api_golden_test", "api_golden_test_npm_package", "ng_package", "ng_project", "ts_config", "tsec_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
npm_link_all_packages(name = "node_modules")
|
||||
|
||||
# This generates the `src/i18n/locale_en.ts` file through the `generate-locales` tool. Since
|
||||
# the base locale file is checked-in for Google3, it is additionally stored in a golden location.
|
||||
generate_base_locale_file(
|
||||
@@ -61,10 +64,20 @@ ng_package(
|
||||
":event_dispatch_contract_binary",
|
||||
"//packages/core/resources",
|
||||
],
|
||||
externals = [
|
||||
# Don't bundle vendored `@mcp-b/webmcp-types` dependency.
|
||||
"../third_party/@mcp-b/webmcp-types",
|
||||
"../../third_party/@mcp-b/webmcp-types",
|
||||
],
|
||||
nested_packages = [
|
||||
"//packages/core/schematics:npm_package",
|
||||
"//packages/core/third_party/@mcp-b/webmcp-types",
|
||||
],
|
||||
package = "@angular/core",
|
||||
substitutions = {
|
||||
# Link `@mcp-b/webmcp-types` to the vendored package.
|
||||
"\\./third_party/@mcp-b/webmcp-types": "../third_party/@mcp-b/webmcp-types/index.js",
|
||||
},
|
||||
tags = [
|
||||
"release-with-framework",
|
||||
],
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mcp-b/webmcp-types": "^2.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler": "0.0.0-PLACEHOLDER",
|
||||
"rxjs": "^6.5.3 || ^7.4.0",
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
load("//tools:defaults.bzl", "js_library")
|
||||
|
||||
genrule(
|
||||
name = "sources",
|
||||
srcs = ["//packages/core:node_modules/@mcp-b/webmcp-types/dir"],
|
||||
outs = [
|
||||
"dist/common.d.ts",
|
||||
"dist/json-schema.d.ts",
|
||||
"LICENSE",
|
||||
],
|
||||
cmd = """
|
||||
readonly SRC_DIR="$(location //packages/core:node_modules/@mcp-b/webmcp-types/dir)"
|
||||
mkdir -p "$$(dirname "$(location dist/common.d.ts)")"
|
||||
cp "$${SRC_DIR}/dist/common.d.ts" "$(location dist/common.d.ts)"
|
||||
cp "$${SRC_DIR}/dist/json-schema.d.ts" "$(location dist/json-schema.d.ts)"
|
||||
cp "$${SRC_DIR}/LICENSE" "$(location LICENSE)"
|
||||
""",
|
||||
)
|
||||
|
||||
js_library(
|
||||
name = "webmcp-types",
|
||||
srcs = [
|
||||
"index.d.ts",
|
||||
":sources",
|
||||
],
|
||||
visibility = ["//packages/core:__subpackages__"],
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
# WebMCP Types
|
||||
|
||||
This directory contains types vendored from `@mcp-b/webmcp-types` to
|
||||
address API extractor issues.
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
export {InferArgsFromInputSchema, JsonSchemaForInference} from './dist/json-schema.js';
|
||||
Generated
+9
@@ -1004,6 +1004,10 @@ importers:
|
||||
zone.js:
|
||||
specifier: ~0.15.0 || ~0.16.0
|
||||
version: 0.16.1
|
||||
devDependencies:
|
||||
'@mcp-b/webmcp-types':
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
|
||||
packages/core/test/bundling:
|
||||
dependencies:
|
||||
@@ -3831,6 +3835,9 @@ packages:
|
||||
'@marijn/find-cluster-break@1.0.2':
|
||||
resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==}
|
||||
|
||||
'@mcp-b/webmcp-types@2.2.0':
|
||||
resolution: {integrity: sha512-1/UYAwQKBkqRgK18GkbGR4m6Cn9vz6Qy6pTL5LIIinUOhR5dMLaNl/blH/tJT+nJleMmgDoFZWGAmmr+fAz2PQ==}
|
||||
|
||||
'@mermaid-js/parser@1.1.0':
|
||||
resolution: {integrity: sha512-gxK9ZX2+Fex5zu8LhRQoMeMPEHbc73UKZ0FQ54YrQtUxE1VVhMwzeNtKRPAu5aXks4FasbMe4xB4bWrmq6Jlxw==}
|
||||
|
||||
@@ -15828,6 +15835,8 @@ snapshots:
|
||||
|
||||
'@marijn/find-cluster-break@1.0.2': {}
|
||||
|
||||
'@mcp-b/webmcp-types@2.2.0': {}
|
||||
|
||||
'@mermaid-js/parser@1.1.0':
|
||||
dependencies:
|
||||
langium: 4.2.3
|
||||
|
||||
Reference in New Issue
Block a user