Socket
Socket
Sign inDemoInstall

@macro-plugin/core

Package Overview
Dependencies
15
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

6

CHANGELOG.md
# @macro-plugin/core
## 1.1.2
### Patch Changes
- [#23](https://github.com/macro-plugin/macros/pull/23) [`294f675`](https://github.com/macro-plugin/macros/commit/294f67574c5ff168bdeb0a499ea4ab2fd57579cf) Thanks [@voorjaar](https://github.com/voorjaar)! - feat: support include, exclude, exclude, extensions, tsconfig options
## 1.1.1

@@ -4,0 +10,0 @@

22

dist/index.d.ts

@@ -291,2 +291,22 @@ import { Identifier, StringLiteral, NumericLiteral, BigIntLiteral, BooleanLiteral, NullLiteral, RegExpLiteral, CallExpression, ClassProperty, PrivateProperty, Param, Constructor, ClassMethod, PrivateMethod, StaticBlock, Decorator, FunctionDeclaration, ClassDeclaration, VariableDeclaration, VariableDeclarator, OptionalChainingExpression, OptionalChainingCall, ThisExpression, ArrayExpression, ObjectExpression, SpreadElement, UnaryExpression, UpdateExpression, BinaryExpression, FunctionExpression, ClassExpression, AssignmentExpression, MemberExpression, SuperPropExpression, ConditionalExpression, Super, Import, NewExpression, SequenceExpression, ArrowFunctionExpression, YieldExpression, MetaProperty, AwaitExpression, TemplateLiteral, TaggedTemplateExpression, TemplateElement, ParenthesisExpression, PrivateName, JSXMemberExpression, JSXNamespacedName, JSXEmptyExpression, JSXExpressionContainer, JSXSpreadChild, JSXOpeningElement, JSXClosingElement, JSXAttribute, JSXText, JSXElement, JSXFragment, JSXOpeningFragment, JSXClosingFragment, ExportDefaultExpression, ExportDeclaration, ImportDeclaration, ExportAllDeclaration, ExportNamedDeclaration, ExportDefaultDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, NamedImportSpecifier, ExportNamespaceSpecifier, ExportDefaultSpecifier, NamedExportSpecifier, Module, Script, ArrayPattern, ObjectPattern, AssignmentPattern, RestElement, KeyValuePatternProperty, AssignmentPatternProperty, KeyValueProperty, AssignmentProperty, GetterProperty, SetterProperty, MethodProperty, ComputedPropName, BlockStatement, ExpressionStatement, EmptyStatement, DebuggerStatement, WithStatement, ReturnStatement, LabeledStatement, BreakStatement, ContinueStatement, IfStatement, SwitchStatement, ThrowStatement, TryStatement, WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement, SwitchCase, CatchClause, TsTypeAnnotation, TsTypeParameterDeclaration, TsTypeParameter, TsTypeParameterInstantiation, TsParameterProperty, TsQualifiedName, TsCallSignatureDeclaration, TsConstructSignatureDeclaration, TsPropertySignature, TsGetterSignature, TsSetterSignature, TsMethodSignature, TsIndexSignature, TsKeywordType, TsThisType, TsFunctionType, TsConstructorType, TsTypeReference, TsTypePredicate, TsImportType, TsTypeQuery, TsTypeLiteral, TsArrayType, TsTupleType, TsTupleElement, TsOptionalType, TsRestType, TsUnionType, TsIntersectionType, TsConditionalType, TsInferType, TsParenthesizedType, TsTypeOperator, TsIndexedAccessType, TsMappedType, TsLiteralType, TsTemplateLiteralType, TsInterfaceDeclaration, TsInterfaceBody, TsExpressionWithTypeArguments, TsTypeAliasDeclaration, TsEnumDeclaration, TsEnumMember, TsModuleDeclaration, TsModuleBlock, TsNamespaceDeclaration, TsImportEqualsDeclaration, TsExternalModuleReference, TsExportAssignment, TsNamespaceExportDeclaration, TsAsExpression, TsInstantiation, TsTypeAssertion, TsConstAssertion, TsNonNullExpression, Invalid, Node, Declaration, Expression, Statement, ModuleItem, TsType, ParseOptions, Options, Plugin, Program, Pattern, Argument, ImportSpecifier, ExportSpecifier } from '@swc/core';

externals?: string[] | Record<string, Record<string, MacroPlugin>>;
/**
* FileNames or Glob Patterns to include, Glob pattern is supported by [picomatch](https://www.npmjs.com/package/picomatch#basic-globbing).
*
* **Note**: When array item is a string, the plugin will treat it as glob pattern, and use `picomatch.makeRe` turn the string into a RegExp, or you can use RegExp directly.
*
* Default value is `[/\.[mc]?[jt]sx?$/]`
*/
include?: (string | RegExp)[];
/**
* Filenames or Glob Patterns to exclude, Glob pattern is supported by [picomatch](https://www.npmjs.com/package/picomatch#basic-globbing).
*
* **Note**: When array item is a string, the plugin will treat it as glob pattern, and use `picomatch.makeRe` turn the string into a RegExp, or you can use RegExp directly.
*
* Default value is `[/node_modules/]`
*/
exclude?: (string | RegExp)[];
/** file extensions to be matched, default is ['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs'] */
extensions?: string[];
/** Use given tsconfig file instead. By default it will find `tsconfig.json` automictly. Disable it by setting to `false` */
tsconfig?: string | false | undefined;
/** emit dts file, default is false */

@@ -299,3 +319,3 @@ emitDts?: boolean;

};
type Config = Omit<Options, "plugin"> & MacroOptions;
type Config = Omit<Options, "plugin" | "test" | "exclude" | "configFile" | "swcrc" | "swcrcRoots" | "filename"> & MacroOptions;

@@ -302,0 +322,0 @@ declare function createSwcPlugin(config: Config, src?: string, spanOffset?: number): Plugin;

2

dist/register.js

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

var e=require("@macro-plugin/core"),t=require("@swc/core"),s=require("fs"),n=require("module"),o=require("path"),r=require("process");const i=new Map([["12","es2018"],["13","es2019"],["14","es2020"],["15","es2021"],["16","es2021"],["17","es2022"]]);function c(e,t,s){let n=e;const o=t.split("."),r=o.pop();for(const e of o)null==n[e]&&(n[e]={}),n=n[e];n[r]=s}const A=["test","exclude","env","jsc","module","minify","sourceMaps","inlineSourcesContent","script","cwd","caller","filename","root","rootMode","envName","configFile","swcrc","swcrcRoots","inputSourceMap","sourceFileName","sourceRoot","plugin","isModule","outputPath"],_=process.cwd(),a=(e,t=_)=>n.createRequire(o.resolve(t,"noop.js"))(e);function R(e){var t;const s=function(e){const t={};for(const[s,n]of Object.entries(e))A.includes(s)&&(t[s]=n);return t}(e);return(null===(t=s.jsc)||void 0===t?void 0:t.target)||c(s,"jsc.target",i.get(process.version.match(/v(\d+)/)[1])||"es2018"),c(s,"jsc.transform.hidden.jest",!0),s.sourceMaps||c(s,"sourceMaps","inline"),s}function u(t){return t.emitDts&&!t.onEmitDts&&(t.onEmitDts=e=>function(e,t){const n=()=>s.writeFile(e,t,(()=>{}));s.existsSync(e)?s.readFile(e,((e,s)=>{(null==e&&t!==s.toString()||e)&&n()})):n()}(o.resolve(t.dtsOutputPath||"./macros.d.ts"),e)),t.depends&&(t.macros||(t.macros=[]),t.macros.push(...function(t){const s=[];for(const n of t)for(const t of Object.values(a(n)))e.isMacroPlugin(t)&&s.push(t);return s}(t.depends))),Array.isArray(t.externals)&&(t.externals=function(t){const s={};for(const n of t){s[n]={};for(const[t,o]of Object.entries(a(n)))e.isMacroPlugin(o)&&(s[n][t]=o)}return s}(t.externals)),t}var E={exports:{}};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.addHook=function(e,t={}){let s=!1;const n=[],o=[];let i;const a=A._extensions[".js"],R=t.matcher||null,u=!1!==t.ignoreNodeModules;i=t.extensions||t.exts||t.extension||t.ext||[".js"],Array.isArray(i)||(i=[i]);return i.forEach((t=>{if("string"!=typeof t)throw new TypeError(`Invalid Extension: ${t}`);const E=A._extensions[t]||a;o[t]=A._extensions[t],n[t]=A._extensions[t]=function(t,n){let o;s||function(e,t,s,n){if("string"!=typeof e)return!1;if(-1===t.indexOf(r.default.extname(e)))return!1;const o=r.default.resolve(e);if(n&&c.test(o))return!1;if(s&&"function"==typeof s)return!!s(o);return!0}(n,i,R,u)&&(o=t._compile,t._compile=function(s){t._compile=o;const r=e(s,n);if("string"!=typeof r)throw new Error(_);return t._compile(r,n)}),E(t,n)}})),function(){s||(s=!0,i.forEach((e=>{A._extensions[e]===n[e]&&(o[e]?A._extensions[e]=o[e]:delete A._extensions[e])})))}};var s=i(n),r=i(o);function i(e){return e&&e.__esModule?e:{default:e}}const c=/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/,A=e.constructor.length>1?e.constructor:s.default,_="[Pirates] A hook returned a non-string, or nothing at all! This is a violation of intergalactic law!\n--------------------\nIf you have no idea what this means or what Pirates is, let me explain: Pirates is a module that makes is easy to implement require hooks. One of the require hooks you're using uses it. One of these require hooks didn't return anything from it's handler, so we don't know what to do. You might want to debug this."}(E,E.exports);var l=E.exports;function C(e){const s=l.addHook((e=>function(e,s=!1){return t.transformSync(e,{module:{type:s?"es6":"commonjs"},jsc:{parser:{syntax:"typescript"},target:"esnext"},swcrc:!1,configFile:!1}).code}(e,function(){try{return require("fs"),!1}catch(e){}return!0}())),{extensions:[".js",".ts"]}),n=require(e);return s(),n}function S(e){const[t,n]=function(){const e=r.cwd(),t=o.join(e,"macros.config.js");if(s.existsSync(t))return[t,require(t)];const n=o.join(e,"macros.config.ts");if(s.existsSync(n)){const e=C(n);return[n,(null==e?void 0:e.default)||{}]}return[void 0,{}]}(),i=Object.assign(Object.assign({},e||{}),n);return[R(i),u(i),t]}const p=o,f="\\\\/",H=`[^${f}]`,O="\\.",d="\\/",L="[^/]",x=`(?:${d}|$)`,T=`(?:^|${d})`,$=`${O}{1,2}${x}`,g={DOT_LITERAL:O,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:d,ONE_CHAR:"(?=.)",QMARK:L,END_ANCHOR:x,DOTS_SLASH:$,NO_DOT:`(?!${O})`,NO_DOTS:`(?!${T}${$})`,NO_DOT_SLASH:`(?!${O}{0,1}${x})`,NO_DOTS_SLASH:`(?!${$})`,QMARK_NO_DOT:`[^.${d}]`,STAR:`${L}*?`,START_ANCHOR:T},m={...g,SLASH_LITERAL:`[${f}]`,QMARK:H,STAR:`${H}*?`,DOTS_SLASH:`${O}{1,2}(?:[${f}]|$)`,NO_DOT:`(?!${O})`,NO_DOTS:`(?!(?:^|[${f}])${O}{1,2}(?:[${f}]|$))`,NO_DOT_SLASH:`(?!${O}{0,1}(?:[${f}]|$))`,NO_DOTS_SLASH:`(?!${O}{1,2}(?:[${f}]|$))`,QMARK_NO_DOT:`[^.${f}]`,START_ANCHOR:`(?:^|[${f}])`,END_ANCHOR:`(?:[${f}]|$)`};var h,N={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:p.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?m:g};function y(){return h||(h=S({})),h}!function(e){const t=o,s="win32"===process.platform,{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:c}=N;e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>i.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(c,"\\$1"),e.toPosixSlashes=e=>e.replace(n,"/"),e.removeBackslashes=e=>e.replace(r,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===s||"\\"===t.sep,e.escapeLast=(t,s,n)=>{const o=t.lastIndexOf(s,n);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,s,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let s=e;return s.startsWith("./")&&(s=s.slice(2),t.prefix="./"),s},e.wrapOutput=(e,t={},s={})=>{let n=`${s.contains?"":"^"}(?:${e})${s.contains?"":"$"}`;return!0===t.negated&&(n=`(?:^(?!${n}).*$)`),n}}({}),l.addHook((function(t){const s=y()[1];return e.transform(t,s).code}),{extensions:[".js"]}),l.addHook((function(s,n){const[o,r]=y(),i=e.createSwcPlugin(r,s,e.getSpanOffset()),c=Object.assign(Object.assign({},o),{module:Object.assign(Object.assign({},o.module),{type:"es6"}),plugin:i,filename:n}),A=/\.(js|ts)x$/.test(n),_=/\.tsx?$/.test(n)?{syntax:"typescript",tsx:A}:{syntax:"ecmascript",jsx:A};return c.jsc?c.jsc.parser=_:c.jsc={parser:_},t.transformSync(s,c).code}),{extensions:[".jsx",".tsx",".ts"]});
var e,n,t,o,r,s,a=require("@macro-plugin/core"),c=require("@swc/core"),i=require("fs"),_=require("path"),l=require("module"),A=require("process");(n=e||(e={}))[n.lineFeed=10]="lineFeed",n[n.carriageReturn=13]="carriageReturn",n[n.space=32]="space",n[n._0=48]="_0",n[n._1=49]="_1",n[n._2=50]="_2",n[n._3=51]="_3",n[n._4=52]="_4",n[n._5=53]="_5",n[n._6=54]="_6",n[n._7=55]="_7",n[n._8=56]="_8",n[n._9=57]="_9",n[n.a=97]="a",n[n.b=98]="b",n[n.c=99]="c",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.g=103]="g",n[n.h=104]="h",n[n.i=105]="i",n[n.j=106]="j",n[n.k=107]="k",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.p=112]="p",n[n.q=113]="q",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.v=118]="v",n[n.w=119]="w",n[n.x=120]="x",n[n.y=121]="y",n[n.z=122]="z",n[n.A=65]="A",n[n.B=66]="B",n[n.C=67]="C",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.G=71]="G",n[n.H=72]="H",n[n.I=73]="I",n[n.J=74]="J",n[n.K=75]="K",n[n.L=76]="L",n[n.M=77]="M",n[n.N=78]="N",n[n.O=79]="O",n[n.P=80]="P",n[n.Q=81]="Q",n[n.R=82]="R",n[n.S=83]="S",n[n.T=84]="T",n[n.U=85]="U",n[n.V=86]="V",n[n.W=87]="W",n[n.X=88]="X",n[n.Y=89]="Y",n[n.Z=90]="Z",n[n.asterisk=42]="asterisk",n[n.backslash=92]="backslash",n[n.closeBrace=125]="closeBrace",n[n.closeBracket=93]="closeBracket",n[n.colon=58]="colon",n[n.comma=44]="comma",n[n.dot=46]="dot",n[n.doubleQuote=34]="doubleQuote",n[n.minus=45]="minus",n[n.openBrace=123]="openBrace",n[n.openBracket=91]="openBracket",n[n.plus=43]="plus",n[n.slash=47]="slash",n[n.formFeed=12]="formFeed",n[n.tab=9]="tab",(t||(t={})).DEFAULT={allowTrailingComma:!1},function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"}(o||(o={})),function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"}(r||(r={})),function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"}(s||(s={})),process;const E=new Map([["12","es2018"],["13","es2019"],["14","es2020"],["15","es2021"],["16","es2021"],["17","es2022"]]),u=["env","jsc","module","minify","sourceMaps","inlineSourcesContent","script","cwd","caller","root","rootMode","envName","inputSourceMap","sourceFileName","sourceRoot","isModule","outputPath"],d=process.cwd(),C=(e,n=d)=>l.createRequire(_.resolve(n,"noop.js"))(e);function R(e){const n=function(e){const n={};for(const[t,o]of Object.entries(e))u.includes(t)&&(n[t]=o);return n}(e);return n.swcrc=!1,n.configFile=!1,n.jsc||(n.jsc={}),n.jsc.target||(n.jsc.target=E.get(process.version.match(/v(\d+)/)[1])||"es2018"),n.sourceMaps||(n.sourceMaps="inline"),n}function p(e){return e.emitDts&&!e.onEmitDts&&(e.onEmitDts=n=>function(e,n){const t=()=>i.writeFile(e,n,(()=>{}));i.existsSync(e)?i.readFile(e,((e,o)=>{(null==e&&n!==o.toString()||e)&&t()})):t()}(_.resolve(e.dtsOutputPath||"./macros.d.ts"),n)),e.depends&&(e.macros||(e.macros=[]),e.macros.push(...function(e){const n=[];for(const t of e)for(const e of Object.values(C(t)))a.isMacroPlugin(e)&&n.push(e);return n}(e.depends))),Array.isArray(e.externals)&&(e.externals=function(e){const n={};for(const t of e){n[t]={};for(const[e,o]of Object.entries(C(t)))a.isMacroPlugin(o)&&(n[t][e]=o)}return n}(e.externals)),e}var m={exports:{}};!function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.addHook=function(e,n={}){let t=!1;const r=[],i=[];let _;const l=a._extensions[".js"],A=n.matcher||null,E=!1!==n.ignoreNodeModules;_=n.extensions||n.exts||n.extension||n.ext||[".js"],Array.isArray(_)||(_=[_]);return _.forEach((n=>{if("string"!=typeof n)throw new TypeError(`Invalid Extension: ${n}`);const u=a._extensions[n]||l;i[n]=a._extensions[n],r[n]=a._extensions[n]=function(n,r){let a;t||function(e,n,t,r){if("string"!=typeof e)return!1;if(-1===n.indexOf(o.default.extname(e)))return!1;const a=o.default.resolve(e);if(r&&s.test(a))return!1;if(t&&"function"==typeof t)return!!t(a);return!0}(r,_,A,E)&&(a=n._compile,n._compile=function(t){n._compile=a;const o=e(t,r);if("string"!=typeof o)throw new Error(c);return n._compile(o,r)}),u(n,r)}})),function(){t||(t=!0,_.forEach((e=>{a._extensions[e]===r[e]&&(i[e]?a._extensions[e]=i[e]:delete a._extensions[e])})))}};var t=r(l),o=r(_);function r(e){return e&&e.__esModule?e:{default:e}}const s=/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/,a=e.constructor.length>1?e.constructor:t.default,c="[Pirates] A hook returned a non-string, or nothing at all! This is a violation of intergalactic law!\n--------------------\nIf you have no idea what this means or what Pirates is, let me explain: Pirates is a module that makes is easy to implement require hooks. One of the require hooks you're using uses it. One of these require hooks didn't return anything from it's handler, so we don't know what to do. You might want to debug this."}(m,m.exports);var f=m.exports;function S(e){const n=f.addHook((e=>function(e,n=!1){return c.transformSync(e,{module:{type:n?"es6":"commonjs"},jsc:{parser:{syntax:"typescript"},target:"esnext"},swcrc:!1,configFile:!1}).code}(e,function(){try{return require("fs"),!1}catch(e){}return!0}())),{extensions:[".js",".ts"]}),t=require(e);return n(),t}function O(e){const[n,t]=function(){const e=A.cwd(),n=_.join(e,"macros.config.js");if(i.existsSync(n))return[n,require(n)];const t=_.join(e,"macros.config.ts");if(i.existsSync(t)){const e=S(t);return[t,(null==e?void 0:e.default)||{}]}return[void 0,{}]}(),o=Object.assign(Object.assign({},e||{}),t);return[R(o),p(o),n]}const H=_,T="\\\\/",x=`[^${T}]`,L="\\.",N="\\/",g="[^/]",h=`(?:${N}|$)`,$=`(?:^|${N})`,v=`${L}{1,2}${h}`,I={DOT_LITERAL:L,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:N,ONE_CHAR:"(?=.)",QMARK:g,END_ANCHOR:h,DOTS_SLASH:v,NO_DOT:`(?!${L})`,NO_DOTS:`(?!${$}${v})`,NO_DOT_SLASH:`(?!${L}{0,1}${h})`,NO_DOTS_SLASH:`(?!${v})`,QMARK_NO_DOT:`[^.${N}]`,STAR:`${g}*?`,START_ANCHOR:$},k={...I,SLASH_LITERAL:`[${T}]`,QMARK:x,STAR:`${x}*?`,DOTS_SLASH:`${L}{1,2}(?:[${T}]|$)`,NO_DOT:`(?!${L})`,NO_DOTS:`(?!(?:^|[${T}])${L}{1,2}(?:[${T}]|$))`,NO_DOT_SLASH:`(?!${L}{0,1}(?:[${T}]|$))`,NO_DOTS_SLASH:`(?!${L}{1,2}(?:[${T}]|$))`,QMARK_NO_DOT:`[^.${T}]`,START_ANCHOR:`(?:^|[${T}])`,END_ANCHOR:`(?:[${T}]|$)`};var y,B={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:H.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?k:I};function w(){return y||(y=O({})),y}!function(e){const n=_,t="win32"===process.platform,{REGEX_BACKSLASH:o,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=B;e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=n=>1===n.length&&e.hasRegexChars(n),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(o,"/"),e.removeBackslashes=e=>e.replace(r,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===t||"\\"===n.sep,e.escapeLast=(n,t,o)=>{const r=n.lastIndexOf(t,o);return-1===r?n:"\\"===n[r-1]?e.escapeLast(n,t,r-1):`${n.slice(0,r)}\\${n.slice(r)}`},e.removePrefix=(e,n={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),n.prefix="./"),t},e.wrapOutput=(e,n={},t={})=>{let o=`${t.contains?"":"^"}(?:${e})${t.contains?"":"$"}`;return!0===n.negated&&(o=`(?:^(?!${o}).*$)`),o}}({}),f.addHook((function(e){const n=w()[1];return a.transform(e,n).code}),{extensions:[".js"]}),f.addHook((function(e,n){const[t,o]=w(),r=a.createSwcPlugin(o,e,a.getSpanOffset()),s=Object.assign(Object.assign({},t),{module:Object.assign(Object.assign({},t.module),{type:"es6"}),plugin:r,filename:n}),i=/\.(js|ts)x$/.test(n),_=/\.tsx?$/.test(n)?{syntax:"typescript",tsx:i}:{syntax:"ecmascript",jsx:i};return s.jsc?s.jsc.parser=_:s.jsc={parser:_},c.transformSync(e,s).code}),{extensions:[".jsx",".tsx",".ts"]});
{
"name": "@macro-plugin/core",
"version": "1.1.1",
"version": "1.1.2",
"description": "Macro system for JavaScript and TypeScript.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc