Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-patch

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-patch - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

9

CHANGELOG.md

@@ -5,2 +5,11 @@ # Changelog

### [3.0.1](https://github.com/nonara/ts-patch/compare/v3.0.0...v3.0.1) (2023-06-22)
### Bug Fixes
* Added explicit error if ts is patched and cached backup is removed ([ac25743](https://github.com/nonara/ts-patch/commit/ac25743140f8f3954aceb8c0e43a731eeeab03a1))
* ESM temp files not cleaned up ([8802054](https://github.com/nonara/ts-patch/commit/8802054481a9f2b4847001cb227db029e0475a72))
* Lock file deletion check ([#102](https://github.com/nonara/ts-patch/issues/102)) ([cacf908](https://github.com/nonara/ts-patch/commit/cacf9084fd4e5a2a1263103f8dc52d2dd7062402))
## [3.0.0](https://github.com/nonara/ts-patch/compare/v2.1.0...v3.0.0) (2023-06-13)

@@ -7,0 +16,0 @@

13

module/ts-module.js

@@ -58,3 +58,2 @@ "use strict";

const isPatched = !!moduleFile.patchDetail;
let moduleSource;
let originalModuleFile;

@@ -77,4 +76,12 @@ const tsModule = {

getUnpatchedModuleFile() {
if (!originalModuleFile)
originalModuleFile = isPatched ? (0, module_file_1.getModuleFile)(backupCachePaths.js) : moduleFile;
if (!originalModuleFile) {
if (isPatched) {
if (!fs_1.default.existsSync(backupCachePaths.js))
throw new system_1.TspError(`Cannot find backup cache file for ${moduleName}. Please wipe node_modules and reinstall.`);
originalModuleFile = (0, module_file_1.getModuleFile)(backupCachePaths.js);
}
else {
originalModuleFile = isPatched ? (0, module_file_1.getModuleFile)(backupCachePaths.js) : moduleFile;
}
}
return originalModuleFile;

@@ -81,0 +88,0 @@ }

{
"name": "ts-patch",
"version": "3.0.0",
"version": "3.0.1",
"description": "Patch typescript to support custom transformers in tsconfig.json",

@@ -46,2 +46,57 @@ "main": "./index.js",

{
"type": "feat",
"section": "Features"
},
{
"type": "feature",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "docs",
"section": "Documentation",
"hidden": true
},
{
"type": "style",
"section": "Styles",
"hidden": true
},
{
"type": "chore",
"section": "Miscellaneous Chores",
"hidden": true
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": true
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System",
"hidden": true
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
},
{
"type": "change",

@@ -48,0 +103,0 @@ "section": "Changes"

@@ -69,3 +69,3 @@ [![npm version](https://badge.fury.io/js/ts-patch.svg)](https://badge.fury.io/js/ts-patch)

**With tools such as ts-node, webpack, etc:** specify the compiler as `ts-patch/compiler`
**With tools such as ts-node, webpack, ts-jest, etc:** specify the compiler as `ts-patch/compiler`

@@ -72,0 +72,0 @@ ## Method 2: Persistent Patch

@@ -53,3 +53,2 @@ var tsp = (function () {

const originalRequire = Module.prototype.require;
const originalReadFileSync = fs.readFileSync;
const builtFiles = new Map();

@@ -67,3 +66,3 @@ const getHash = () => {

try {
fs.readFileSync(filePath, "utf8");
fs.rmSync(filePath, { force: true, maxRetries: 3 });
}

@@ -97,3 +96,3 @@ catch (e) {

if (!builtFiles.has(resolvedPath)) {
const tsCode = originalReadFileSync(resolvedPath, "utf8");
const tsCode = fs.readFileSync(resolvedPath, "utf8");
const jsCode = registerConfig.tsNodeInstance.compile(tsCode, resolvedPath);

@@ -100,0 +99,0 @@ const outputFileName = getHash() + ".mjs";

@@ -72,3 +72,4 @@ "use strict";

finally {
fs_1.default.unlinkSync(lockFilePath);
if (fs_1.default.existsSync(lockFilePath))
fs_1.default.unlinkSync(lockFilePath);
}

@@ -75,0 +76,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc