Socket
Socket
Sign inDemoInstall

ssg-api

Package Overview
Dependencies
Maintainers
1
Versions
76
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.9.0 to 1.9.1

12

CHANGELOG.md

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

## [1.9.1] - 2024-05-20
### Changed
- `DirectoryStep.config` visibility to public readonly.
### Fixed
- `CopyStep` now uses its config `outDir`.
## [1.9.0] - 2024-05-20

@@ -14,3 +24,3 @@

- `SsgConfig.outDir` is now `SsgConfig.getOutputPath(context)`
- All steps configs now extend `SsgConfig` to benefit from output path resolution.
- All steps configs now extend `SsgConfig` to benefit from output path resolution.

@@ -17,0 +27,0 @@ ## [1.8.0] - 2024-05-18

4

dist/src/SsgContextImpl.js
import { ObjectUtil } from "./util/ObjectUtil.js";
import { ConsoleLogger } from "./ConsoleLogger";
import { HtmlSsgFile, SsgFile } from "./util";
import * as assert from "node:assert";
export class SsgContextImpl {

@@ -31,3 +32,4 @@ constructor(locale, vars = new Map(), name = SsgContextImpl.DEFAULT_NAME, logger = new ConsoleLogger(name), currentFile = undefined) {

get file() {
return ObjectUtil.asSet(this._file, "Should have a inputFile");
assert.ok(this._file, "Should have a file");
return this._file;
}

@@ -34,0 +36,0 @@ set file(value) {

@@ -1,7 +0,8 @@

import { SsgStep } from './SsgStep.js';
import { SsgContext } from '../SsgContext.js';
import { IOptions } from 'glob';
import { SsgConfig } from '../SsgConfig';
import { SsgStep } from "./SsgStep.js";
import { SsgContext } from "../SsgContext.js";
import { IOptions } from "glob";
import { SsgConfig } from "../SsgConfig";
export interface CopyStepConfig extends SsgConfig {
readonly copies: string[];
readonly sourcePatterns: string[];
readonly destDir: string;
readonly options?: IOptions;

@@ -8,0 +9,0 @@ }

@@ -1,4 +0,3 @@

import * as process from 'process';
import * as process from "process";
import { FileUtil } from "../util";
import path from "path";
/**

@@ -10,10 +9,9 @@ * Perform copies to out directory.

this.config = config;
this.name = 'copy';
this.name = "copy";
}
async execute(context) {
const copies = this.config.copies;
const destPath = this.config.getOutputPath(context);
const dest = path.dirname(destPath);
const copies = this.config.sourcePatterns;
const dest = this.config.destDir;
try {
context.log('Copying to', dest, copies);
context.log("Copying to", dest, copies);
const copiedFiles = await FileUtil.ssgCopy(dest, copies, this.config.options);

@@ -20,0 +18,0 @@ const cwd = process.cwd();

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

export declare abstract class DirectoryStep<C extends SsgContext = SsgContext> implements SsgStep<C, DirectoryResult> {
protected config: DirectoryStepConfig;
readonly config: DirectoryStepConfig;
readonly name: string;

@@ -31,0 +31,0 @@ /**

@@ -1,4 +0,1 @@

export declare class AssertionError extends Error {
constructor(message: string);
}
export declare class ObjectUtil {

@@ -5,0 +2,0 @@ static isUndefined(obj: any): boolean;

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

export class AssertionError extends Error {
constructor(message) {
super(message);
}
}
import * as assert from "node:assert";
export class ObjectUtil {

@@ -14,7 +10,5 @@ static isUndefined(obj) {

static asSet(obj, msg) {
if (this.isNotSet(obj)) {
throw new AssertionError(msg !== null && msg !== void 0 ? msg : "value is not set");
}
assert.ok(!this.isNotSet(obj));
return obj;
}
}

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

"author": "Jérôme Beau <javarome@gmail.com> (https://javarome.com)",
"version": "1.9.0",
"version": "1.9.1",
"description": "Static Site Generation TypeScript API",

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

@@ -19,5 +19,9 @@ # ssg-api [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Javarome/ssg-api/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Javarome/ssg-api/tree/main)

```ts
import {Ssg, SsgContextImpl, SsgConfig} from "ssg-api";
import { Ssg, SsgContextImpl, SsgConfig } from "ssg-api";
const config: SsgConfig = {outDir: "out"};
const config: SsgConfig = {
getOutputPath(context: SsgContext): string {
return path.join("out", context.file.name)
}
};
const ssg = new Ssg(config)

@@ -24,0 +28,0 @@ .add(firstStep)

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