From b11f94a6470c805896623ba8c043fcca0e3bb89f Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Thu, 16 Nov 2023 15:13:14 +0100 Subject: [PATCH] don't share options object --- src/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index e091e1d..545c615 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,16 +2,18 @@ import fs from 'node:fs' import path from 'node:path' import process from 'node:process' -const defaultOptions = { - matcher: /@import\((?.+)\)(\s*?\[(?\d+-\d+)\])?/g, - root: process.cwd(), +function defaultOptions() { + return { + matcher: /@import\((?.+)\)(\s*?\[(?\d+-\d+)\])?/g, + root: process.cwd(), + } } -export type Options = Partial +export type Options = Partial> export function importPlugin(md: any, options: Options = {}) { // Options - const o = Object.assign(defaultOptions, options) + const o = Object.assign(defaultOptions(), options) // Parser function parse(code: string, alreadyVisited: string[] = []) {