/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/ngtools/webpack/src/loaders/inline-resource.ts
33 строки
959 B
Charles Lyding
refactor(@ngtools/webpack): add types to exported module variables
15 янв 2025, 17:06
15 янв 2025, 17:06
e5368b8
Код
Авторство
О чём код?
/** * @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 */ import type { Compilation, LoaderContext } from 'webpack'; export const InlineAngularResourceLoaderPath: string = __filename; export const InlineAngularResourceSymbol: unique symbol = Symbol( '@ngtools/webpack[angular-resource]', ); export interface CompilationWithInlineAngularResource extends Compilation { [InlineAngularResourceSymbol]: string; } export default function (this: LoaderContext<{ data?: string }>): void { const callback = this.async(); const { data } = this.getOptions(); if (data) { callback(undefined, Buffer.from(data, 'base64').toString()); } else { const content = (this._compilation as CompilationWithInlineAngularResource)[ InlineAngularResourceSymbol ]; callback(undefined, content); } }