@pagepocket/replace-elements-unit 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export { ReplaceElementsV3Plugin } from "./replace-elements-plugin-v3.js";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { ReplaceElementsV3Plugin } from "./replace-elements-plugin-v3.js";
@@ -0,0 +1,13 @@
1
+ import type { ReplaceElementsConfig } from "@pagepocket/lib";
2
+ import type { PagePocketContext, PagePocketPlugin } from "@pagepocket/lib";
3
+ export type ReplaceElementsPluginOptions = {
4
+ enabled?: boolean;
5
+ rules: ReplaceElementsConfig;
6
+ };
7
+ export declare class ReplaceElementsPlugin implements PagePocketPlugin {
8
+ readonly name = "plugin:replace-elements";
9
+ enabled?: boolean;
10
+ private rules;
11
+ constructor(options: ReplaceElementsPluginOptions);
12
+ apply(ctx: PagePocketContext): void;
13
+ }
package/dist/plugin.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReplaceElementsPlugin = void 0;
4
+ class ReplaceElementsPlugin {
5
+ constructor(options) {
6
+ this.name = "plugin:replace-elements";
7
+ this.enabled = options.enabled;
8
+ this.rules = options.rules;
9
+ }
10
+ apply(ctx) {
11
+ ctx.addReplaceElements(this.rules);
12
+ }
13
+ }
14
+ exports.ReplaceElementsPlugin = ReplaceElementsPlugin;
@@ -0,0 +1,11 @@
1
+ import type { ReplaceElementsConfig } from "@pagepocket/contracts";
2
+ import type { Plugin, PluginHost } from "@pagepocket/lib";
3
+ export type ReplaceElementsV3PluginOptions = {
4
+ rules: ReplaceElementsConfig;
5
+ };
6
+ export declare class ReplaceElementsV3Plugin implements Plugin {
7
+ readonly name = "plugin:replace-elements";
8
+ private rules;
9
+ constructor(options: ReplaceElementsV3PluginOptions);
10
+ setup(host: PluginHost): void;
11
+ }
@@ -0,0 +1,9 @@
1
+ export class ReplaceElementsV3Plugin {
2
+ constructor(options) {
3
+ this.name = "plugin:replace-elements";
4
+ this.rules = options.rules;
5
+ }
6
+ setup(host) {
7
+ host.elements.contribute({ type: "plugin", name: this.name }, this.rules);
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ import type { PagePocketContext, PagePocketPlugin, ReplaceElementsConfig } from "@pagepocket/lib";
2
+ export type ReplaceElementsPluginOptions = {
3
+ rules: ReplaceElementsConfig;
4
+ };
5
+ export declare class ReplaceElementsPlugin implements PagePocketPlugin {
6
+ readonly name = "plugin:replace-elements";
7
+ private rules;
8
+ constructor(options: ReplaceElementsPluginOptions);
9
+ apply(ctx: PagePocketContext): void;
10
+ }
@@ -0,0 +1,9 @@
1
+ export class ReplaceElementsPlugin {
2
+ constructor(options) {
3
+ this.name = "plugin:replace-elements";
4
+ this.rules = options.rules;
5
+ }
6
+ apply(ctx) {
7
+ ctx.addReplaceElements(this.rules);
8
+ }
9
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@pagepocket/replace-elements-unit",
3
+ "version": "0.8.0",
4
+ "description": "PagePocket plugin: register replaceElements rules",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "@pagepocket/contracts": "0.8.0",
14
+ "@pagepocket/lib": "0.8.0"
15
+ },
16
+ "devDependencies": {
17
+ "typescript": "^5.4.5"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "test": "node -e \"process.exit(0)\""
22
+ }
23
+ }