1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

Change from js to ts

This commit is contained in:
Adria Navarro 2024-02-21 20:50:57 +01:00
parent 3b757476e0
commit 046e27c737
15 changed files with 6 additions and 3 deletions

View file

@ -11,7 +11,7 @@ const production = !process.env.ROLLUP_WATCH
export default [ export default [
{ {
input: "src/index.js", input: "src/index.ts",
output: { output: {
sourcemap: !production, sourcemap: !production,
format: "cjs", format: "cjs",

View file

@ -3,7 +3,7 @@ import { create } from "handlebars"
import { registerAll, registerMinimum } from "./helpers/index" import { registerAll, registerMinimum } from "./helpers/index"
import { preprocess, postprocess } from "./processors" import { preprocess, postprocess } from "./processors"
import { atob, btoa, isBackendService } from "./utilities" import { atob, btoa, isBackendService } from "./utilities"
import manifest from "../manifest.json" const manifest = require("../manifest.json")
import { import {
FIND_HBS_REGEX, FIND_HBS_REGEX,
FIND_ANY_HBS_REGEX, FIND_ANY_HBS_REGEX,

View file

@ -11,12 +11,15 @@ export const PreprocessorNames = {
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
class Preprocessor { class Preprocessor {
private name: string
private fn: any
constructor(name, fn) { constructor(name, fn) {
this.name = name this.name = name
this.fn = fn this.fn = fn
} }
process(fullString, statement, opts) { process(fullString: string, statement: string, opts: Object) {
const output = this.fn(statement, opts) const output = this.fn(statement, opts)
const idx = fullString.indexOf(statement) const idx = fullString.indexOf(statement)
return swapStrings(fullString, idx, statement.length, output) return swapStrings(fullString, idx, statement.length, output)