@herberttn/bytenode-webpack-plugin
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -0,1 +1,8 @@ | ||
## [1.2.5](https://github.com/herberttn/bytenode-webpack-plugin/compare/v1.2.4...v1.2.5) (2021-04-24) | ||
### Bug Fixes | ||
* webpack externals need to receive posix style paths ([ba012c5](https://github.com/herberttn/bytenode-webpack-plugin/commit/ba012c5e9cffb509640be73d070f1dcdbf114f90)) | ||
## [1.2.4](https://github.com/herberttn/bytenode-webpack-plugin/compare/v1.2.3...v1.2.4) (2021-04-23) | ||
@@ -2,0 +9,0 @@ |
import type { WebpackPluginInstance } from 'webpack'; | ||
import type { Compiler, WebpackOptionsNormalized } from './normalized'; | ||
import type { Options, PreprocessedEntry, PreprocessedOutput, ProcessedOptions } from './types'; | ||
import type { Compiler, WebpackOptionsNormalized } from './types-normalized'; | ||
declare class BytenodeWebpackPlugin implements WebpackPluginInstance { | ||
@@ -10,4 +10,2 @@ private readonly name; | ||
processOptions(options: WebpackOptionsNormalized): ProcessedOptions; | ||
toRelativeImportPath(directory: string, from: string, to: string): string; | ||
removeExtension(location: string): string; | ||
preprocessOutput({ context, output }: WebpackOptionsNormalized): PreprocessedOutput; | ||
@@ -14,0 +12,0 @@ preprocessEntry({ context, entry }: WebpackOptionsNormalized): PreprocessedEntry[]; |
@@ -14,2 +14,3 @@ "use strict"; | ||
const loader_1 = require("./loader"); | ||
const paths_1 = require("./paths"); | ||
v8_1.default.setFlagsFromString('--no-lazy'); | ||
@@ -109,3 +110,3 @@ class BytenodeWebpackPlugin { | ||
const to = output.of(name); | ||
let relativeImportPath = this.toRelativeImportPath(options.output.path, from, to); | ||
let relativeImportPath = paths_1.toRelativeImportPath(options.output.path, from, to); | ||
if (options.target === 'electron-renderer' && options.mode === 'development') { | ||
@@ -130,16 +131,2 @@ relativeImportPath = path_1.default.resolve(options.output.path, 'renderer', relativeImportPath); | ||
} | ||
toRelativeImportPath(directory, from, to) { | ||
from = this.removeExtension(from); | ||
to = this.removeExtension(to); | ||
const fromLocation = path_1.default.join(directory, from); | ||
const toLocation = path_1.default.join(directory, to); | ||
const relativePath = path_1.default.relative(path_1.default.dirname(fromLocation), toLocation); | ||
if (relativePath === to) { | ||
return `./${relativePath}`; | ||
} | ||
return relativePath; | ||
} | ||
removeExtension(location) { | ||
return location.substr(0, location.length - path_1.default.extname(location).length); | ||
} | ||
preprocessOutput({ context, output }) { | ||
@@ -146,0 +133,0 @@ let filename = output?.filename ?? '[name].js'; |
@@ -12,5 +12,3 @@ "use strict"; | ||
if (/win32/.test(os_1.platform()) && path_1.win32.isAbsolute(relativePath)) { | ||
relativePath = exhaustiveReplace(relativePath, /\/\//g, '/'); | ||
relativePath = exhaustiveReplace(relativePath, /\//g, '\\'); | ||
relativePath = exhaustiveReplace(relativePath, /\\\\/g, '\\'); | ||
relativePath = path_1.win32.normalize(relativePath); | ||
relativePath = relativePath.replace(/\\/g, '\\\\'); | ||
@@ -27,8 +25,2 @@ } | ||
exports.createLoaderCode = createLoaderCode; | ||
function exhaustiveReplace(source, regex, target) { | ||
if (regex.test(source)) { | ||
return exhaustiveReplace(source.replace(regex, target), regex, target); | ||
} | ||
return source; | ||
} | ||
//# sourceMappingURL=loader.js.map |
{ | ||
"name": "@herberttn/bytenode-webpack-plugin", | ||
"description": "Compile JavaScript into bytecode using bytenode", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": { |
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
Sorry, the diff of this file is not supported yet
39076
24
381