|
| 1 | +//// [tests/cases/conformance/node/legacyNodeModulesExportsSpecifierGenerationConditions.ts] //// |
| 2 | + |
| 3 | +//// [index.ts] |
| 4 | +export const a = async () => (await import("inner")).x(); |
| 5 | +//// [index.d.ts] |
| 6 | +export { x } from "./other.js"; |
| 7 | +//// [other.d.ts] |
| 8 | +import { Thing } from "./private.js" |
| 9 | +export const x: () => Thing; |
| 10 | +//// [private.d.ts] |
| 11 | +export interface Thing {} // not exported in export map, inaccessible under new module modes |
| 12 | +//// [package.json] |
| 13 | +{ |
| 14 | + "name": "package", |
| 15 | + "private": true, |
| 16 | + "type": "module", |
| 17 | + "exports": "./index.js" |
| 18 | +} |
| 19 | +//// [package.json] |
| 20 | +{ |
| 21 | + "name": "inner", |
| 22 | + "private": true, |
| 23 | + "type": "module", |
| 24 | + "exports": { |
| 25 | + ".": { |
| 26 | + "default": "./index.js" |
| 27 | + }, |
| 28 | + "./other": { |
| 29 | + "default": "./other.js" |
| 30 | + } |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +//// [index.js] |
| 35 | +"use strict"; |
| 36 | +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
| 37 | + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
| 38 | + return new (P || (P = Promise))(function (resolve, reject) { |
| 39 | + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
| 40 | + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
| 41 | + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
| 42 | + step((generator = generator.apply(thisArg, _arguments || [])).next()); |
| 43 | + }); |
| 44 | +}; |
| 45 | +var __generator = (this && this.__generator) || function (thisArg, body) { |
| 46 | + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
| 47 | + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; |
| 48 | + function verb(n) { return function (v) { return step([n, v]); }; } |
| 49 | + function step(op) { |
| 50 | + if (f) throw new TypeError("Generator is already executing."); |
| 51 | + while (_) try { |
| 52 | + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; |
| 53 | + if (y = 0, t) op = [op[0] & 2, t.value]; |
| 54 | + switch (op[0]) { |
| 55 | + case 0: case 1: t = op; break; |
| 56 | + case 4: _.label++; return { value: op[1], done: false }; |
| 57 | + case 5: _.label++; y = op[1]; op = [0]; continue; |
| 58 | + case 7: op = _.ops.pop(); _.trys.pop(); continue; |
| 59 | + default: |
| 60 | + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } |
| 61 | + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } |
| 62 | + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } |
| 63 | + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } |
| 64 | + if (t[2]) _.ops.pop(); |
| 65 | + _.trys.pop(); continue; |
| 66 | + } |
| 67 | + op = body.call(thisArg, _); |
| 68 | + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } |
| 69 | + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; |
| 70 | + } |
| 71 | +}; |
| 72 | +exports.__esModule = true; |
| 73 | +exports.a = void 0; |
| 74 | +var a = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { |
| 75 | + switch (_a.label) { |
| 76 | + case 0: return [4 /*yield*/, Promise.resolve().then(function () { return require("inner"); })]; |
| 77 | + case 1: return [2 /*return*/, (_a.sent()).x()]; |
| 78 | + } |
| 79 | +}); }); }; |
| 80 | +exports.a = a; |
| 81 | + |
| 82 | + |
| 83 | +//// [index.d.ts] |
| 84 | +export declare const a: () => Promise<import("inner/private").Thing>; |
0 commit comments