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

ssg-api

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssg-api - npm Package Compare versions

Comparing version 1.4.2 to 1.4.3

6

CHANGELOG.md

@@ -8,2 +8,8 @@ # Change Log

## [1.4.3] - 2023-04-23
### Fixed
- Read files from context now read HTML files as such.
## [1.4.2] - 2023-01-22

@@ -10,0 +16,0 @@

4

dist/src/SsgContext.d.ts

@@ -1,2 +0,2 @@

import { SsgFile } from "./util/file/SsgFile";
import { SsgFile } from "./util";
import { Logger } from "./Logger";

@@ -39,2 +39,4 @@ export interface SsgContext<V = any> extends Logger {

pop(): SsgContext;
read(fileName: string): void;
readOrNew(fileName: string, outDir: string): void;
}

@@ -1,2 +0,2 @@

import { SsgFile } from "./util/file/SsgFile";
import { SsgFile } from "./util";
import { SsgContext } from "./SsgContext";

@@ -42,2 +42,4 @@ import { Logger } from "./Logger";

pop(): SsgContext;
read(fileName: string): void;
readOrNew(fileName: string, outDir: string): void;
}

@@ -0,3 +1,6 @@

import { SsgFile } from "./util";
import { ObjectUtil } from "./util/ObjectUtil";
import { DefaultLogger } from "./DefaultLogger";
import path from "path";
import { HtmlSsgFile } from "./util";
export class SsgContextImpl {

@@ -87,4 +90,17 @@ constructor(locale, vars = new Map(), name = SsgContextImpl.DEFAULT_NAME, logger = new DefaultLogger(name), currentFile = undefined) {

}
read(fileName) {
this.inputFile = fileName.endsWith(".html")
? HtmlSsgFile.read(this, fileName)
: SsgFile.read(this, fileName);
}
readOrNew(fileName, outDir) {
var _a;
const filePath = path.join(outDir, fileName);
const encoding = (_a = this._outputFile) === null || _a === void 0 ? void 0 : _a.encoding;
this.outputFile = fileName.endsWith(".html")
? HtmlSsgFile.readOrNew(this, filePath, encoding)
: SsgFile.readOrNew(this, filePath, encoding);
}
}
SsgContextImpl.CONTEXT_PREFIX = "$context.";
SsgContextImpl.DEFAULT_NAME = "Ssg";

@@ -21,3 +21,3 @@ import { SsgStep } from "./SsgStep";

* Execute the directory step by:
* 1. finding all the subdirs of each this.dirs
* 1. finding all the subdirectories of each this.dirs
* 2. processing the found directories through the `processDirs()` method.

@@ -24,0 +24,0 @@ * 3. returning the count of processed directories

@@ -1,2 +0,2 @@

import { FileUtil, SsgFile } from "../util";
import { FileUtil } from "../util";
/**

@@ -17,3 +17,3 @@ * A step to enrich a template from some subdirectories processing.

* Execute the directory step by:
* 1. finding all the subdirs of each this.dirs
* 1. finding all the subdirectories of each this.dirs
* 2. processing the found directories through the `processDirs()` method.

@@ -23,4 +23,4 @@ * 3. returning the count of processed directories

async execute(context) {
context.inputFile = SsgFile.read(context, this.template);
context.outputFile = SsgFile.readOrNew(context, `${this.config.outDir}/${this.template}`);
context.read(this.template);
context.readOrNew(this.template, this.config.outDir);
const dirNames = (await this.findDirs(this.dirs))

@@ -27,0 +27,0 @@ .filter(dirName => !this.excludedDirs.includes(dirName));

@@ -5,3 +5,3 @@ {

"author": "Jérôme Beau",
"version": "1.4.2",
"version": "1.4.3",
"description": "Static Site Generation TypeScript API",

@@ -8,0 +8,0 @@ "exports": "./dist/src/index.js",

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