mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
ef39107ce5
Typescript recently consolidated `tsserverlibrary` into `typescript`: [blog post](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/#consolidation-between-tsserverlibrary-js-and-typescript-js) In this commit, we remove all references to `tsserverlibrary` accordingly. This should be safe, since v18 and later support TS 5.3+. PR Close #54726
66 lines
1.4 KiB
JavaScript
66 lines
1.4 KiB
JavaScript
/**
|
|
* @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.io/license
|
|
*/
|
|
|
|
|
|
const {nodeResolve} = require('@rollup/plugin-node-resolve');
|
|
const commonJs = require('@rollup/plugin-commonjs');
|
|
|
|
// This is a custom AMD file header that patches the AMD `define` call generated
|
|
// by rollup so that the bundle exposes a CJS-exported function which takes an
|
|
// instance of the TypeScript module. More details in `/language-service/index.ts`.
|
|
const amdFileHeader = `
|
|
/**
|
|
* @license Angular v0.0.0-PLACEHOLDER
|
|
* Copyright Google LLC All Rights Reserved.
|
|
* License: MIT
|
|
*/
|
|
|
|
let $deferred;
|
|
function define(modules, callback) {
|
|
$deferred = {modules, callback};
|
|
}
|
|
module.exports = function(provided) {
|
|
const ts = provided['typescript'];
|
|
if (!ts) {
|
|
throw new Error('Caller does not provide typescript module');
|
|
}
|
|
const results = {};
|
|
const resolvedModules = $deferred.modules.map(m => {
|
|
if (m === 'exports') {
|
|
return results;
|
|
}
|
|
if (m === 'typescript') {
|
|
return ts;
|
|
}
|
|
return require(m);
|
|
});
|
|
$deferred.callback(...resolvedModules);
|
|
return results;
|
|
};
|
|
`;
|
|
|
|
const external = [
|
|
'os',
|
|
'fs',
|
|
'path',
|
|
'typescript',
|
|
];
|
|
|
|
const config = {
|
|
external,
|
|
plugins: [
|
|
nodeResolve({preferBuiltins: true}),
|
|
commonJs(),
|
|
],
|
|
output: {
|
|
banner: amdFileHeader,
|
|
},
|
|
};
|
|
|
|
module.exports = config;
|