Comparing version
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
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 __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -38,0 +48,0 @@ exports.Catalog = void 0; |
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
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 __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -38,0 +48,0 @@ exports.DTDParser = void 0; |
@@ -16,2 +16,3 @@ "use strict"; | ||
const Constants_1 = require("./Constants"); | ||
const TextNode_1 = require("./TextNode"); | ||
const XMLDeclaration_1 = require("./XMLDeclaration"); | ||
@@ -41,3 +42,11 @@ const XMLDocumentType_1 = require("./XMLDocumentType"); | ||
setDocumentType(documentType) { | ||
this.content.push(documentType); | ||
if (this.content.length > 0) { | ||
let firstNode = this.content[0]; | ||
if (firstNode instanceof XMLDeclaration_1.XMLDeclaration) { | ||
this.content.splice(1, 0, new TextNode_1.TextNode('\n')); | ||
this.content.splice(2, 0, documentType); | ||
return; | ||
} | ||
} | ||
this.content.splice(0, 0, documentType); | ||
} | ||
@@ -44,0 +53,0 @@ getDocumentType() { |
@@ -15,3 +15,2 @@ /******************************************************************************* | ||
export declare class XMLWriter { | ||
static readonly UTF16: Buffer; | ||
file: string; | ||
@@ -18,0 +17,0 @@ options: any; |
@@ -18,3 +18,2 @@ "use strict"; | ||
class XMLWriter { | ||
static UTF16 = Buffer.from([-2, -1]); | ||
file; | ||
@@ -33,6 +32,8 @@ options = { | ||
if (enc === 'UTF-16LE') { | ||
// write BOM for UTF-16LE | ||
this.options.encoding = 'utf16le'; | ||
(0, fs_1.writeFileSync)(this.file, XMLWriter.UTF16, this.options); | ||
this.started = true; | ||
if (!this.started) { | ||
// write BOM for UTF-16LE | ||
(0, fs_1.writeFileSync)(this.file, '\ufeff', this.options); | ||
this.started = true; | ||
} | ||
} | ||
@@ -65,4 +66,3 @@ } | ||
// write BOM for UTF-16LE | ||
(0, fs_1.writeFileSync)(file, XMLWriter.UTF16, options); | ||
(0, fs_1.appendFileSync)(file, doc.toString(), options); | ||
(0, fs_1.writeFileSync)(file, '\ufeff' + doc.toString(), options); | ||
return; | ||
@@ -69,0 +69,0 @@ } |
{ | ||
"name": "typesxml", | ||
"productName": "TypesXML", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "Open source XML library written in TypeScript", | ||
@@ -32,5 +32,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^20.14.14", | ||
"typescript": "^5.5.4" | ||
"@types/node": "^22.10.5", | ||
"typescript": "^5.7.2" | ||
} | ||
} |
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
283039
0.45%4360
0.65%