/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v2.7.2
ext/bundle/bundle.ts
45 строк
1 KB
Kenta Moriuchi
chore: Happy New Year 2026 (#31748)
08 янв 2026, 18:28
Не верифицирован
08 янв 2026, 18:28
8193cf9
Код
Авторство
О чём код?
// Copyright 2018-2026 the Deno authors. MIT license. /// <reference path="../../cli/tsc/dts/lib.deno.unstable.d.ts" /> import { op_bundle } from "ext:core/ops"; import { primordials } from "ext:core/mod.js"; import { TextDecoder } from "ext:deno_web/08_text_encoding.js"; const { SafeArrayIterator, Uint8Array, ObjectPrototypeIsPrototypeOf } = primordials; const decoder = new TextDecoder(); export async function bundle( options: Deno.bundle.Options, ): Promise<Deno.bundle.Result> { const result = { success: false, ...await op_bundle( options, ), }; result.success = result.errors.length === 0; for ( const f of new SafeArrayIterator( // deno-lint-ignore no-explicit-any result.outputFiles as any ?? [], ) ) { // deno-lint-ignore no-explicit-any const file = f as any; if (file.contents?.length === 0) { delete file.contents; file.text = () => ""; } else { if (!ObjectPrototypeIsPrototypeOf(Uint8Array, file.contents)) { file.contents = new Uint8Array(file.contents); } file.text = () => decoder.decode(file.contents ?? ""); } } if (result.outputFiles?.length === 0) { delete result.outputFiles; } return result; }