Comparing version 4.12.0 to 4.13.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,3 +27,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const path_1 = __importDefault(require("path")); | ||
const path = __importStar(require("path")); | ||
const Node_1 = require("./Node"); | ||
@@ -341,13 +360,11 @@ const typeImportMarker = '(?:t:)?'; | ||
} | ||
// Drop the `./` prefix from the outputPath if it exists. | ||
const basePath = outputPath.replace(/^.\//, ''); | ||
// Ideally we'd use a path library to do all this. | ||
const numberOfDirs = basePath.split('').filter((l) => l === '/').length; | ||
if (numberOfDirs === 0) { | ||
return importPath; | ||
importPath = path.normalize(importPath); | ||
outputPath = path.normalize(outputPath); | ||
const outputPathDir = path.dirname(outputPath); | ||
let relativePath = path.relative(outputPathDir, importPath); | ||
if (!relativePath.startsWith('.')) { | ||
// ensure the js compiler recognizes this is a relative path. | ||
relativePath = './' + relativePath; | ||
} | ||
// Make an array of `..` to get our importPath to the root directory. | ||
const a = new Array(numberOfDirs); | ||
const prefix = a.fill('..', 0, numberOfDirs).join('/'); | ||
return prefix + importPath.substring(1); | ||
return relativePath; | ||
} | ||
@@ -357,4 +374,4 @@ exports.maybeRelativePath = maybeRelativePath; | ||
function sameModule(path1, path2) { | ||
return path1 === path2 || path_1.default.resolve(path1) === path_1.default.resolve(path2); | ||
return path1 === path2 || path.resolve(path1) === path.resolve(path2); | ||
} | ||
exports.sameModule = sameModule; |
{ | ||
"name": "ts-poet", | ||
"version": "4.12.0", | ||
"version": "4.13.0", | ||
"description": "code generation DSL for TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110876
2056