extra-javascript-text.web
Advanced tools
Comparing version 0.1.12 to 0.1.13
122
index.d.ts
@@ -5,5 +5,4 @@ /** | ||
* @param full full string | ||
* */ | ||
declare type StringMatchFunction = (full: string) => void; | ||
*/ | ||
type StringMatchFunction = (full: string) => void; | ||
/** | ||
@@ -14,4 +13,3 @@ * Match string in javascript text. | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachString(txt: string, fn: StringMatchFunction): void; | ||
@@ -23,4 +21,3 @@ /** | ||
* @returns strings | ||
* */ | ||
*/ | ||
declare function strings(txt: string): string[]; | ||
@@ -32,5 +29,4 @@ /** | ||
* @returns updated string | ||
* */ | ||
declare type StringReplaceFunction = (full: string) => string; | ||
*/ | ||
type StringReplaceFunction = (full: string) => string; | ||
/** | ||
@@ -42,4 +38,3 @@ * Replace strings in javascript text. | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceStrings(txt: string, fn: StringReplaceFunction): string; | ||
@@ -51,4 +46,3 @@ /** | ||
* @returns [updated javascript text, tags] | ||
* */ | ||
*/ | ||
declare function tagStrings(txt: string): [string, Map<string, string>]; | ||
@@ -61,4 +55,3 @@ /** | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function untagStrings(txt: string, tags: Map<string, string>): string; | ||
@@ -69,5 +62,4 @@ /** | ||
* @param full full comment | ||
* */ | ||
declare type CommentMatchFunction = (full: string) => void; | ||
*/ | ||
type CommentMatchFunction = (full: string) => void; | ||
/** | ||
@@ -78,4 +70,3 @@ * Match links in javascript text. | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachComment(txt: string, fn: CommentMatchFunction): void; | ||
@@ -87,4 +78,3 @@ /** | ||
* @returns comments | ||
* */ | ||
*/ | ||
declare function comments(txt: string): string[]; | ||
@@ -96,5 +86,4 @@ /** | ||
* @returns updated comment | ||
* */ | ||
declare type CommentReplaceFunction = (full: string) => string; | ||
*/ | ||
type CommentReplaceFunction = (full: string) => string; | ||
/** | ||
@@ -106,4 +95,3 @@ * Replace comments in javascript text. | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceComments(txt: string, fn: CommentReplaceFunction): string; | ||
@@ -115,4 +103,3 @@ /** | ||
* @returns [updated javascript text, tags] | ||
* */ | ||
*/ | ||
declare function tagComments(txt: string): [string, Map<string, string>]; | ||
@@ -125,4 +112,3 @@ /** | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function untagComments(txt: string, tags: Map<string, string>): string; | ||
@@ -132,4 +118,3 @@ /** | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/uncomment) | ||
* */ | ||
*/ | ||
declare function uncomment(txt: string, empty?: boolean): string; | ||
@@ -145,5 +130,4 @@ /** | ||
* @param isDefault symbol is default? | ||
* */ | ||
declare type JsdocSymbolMatchFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => void; | ||
*/ | ||
type JsdocSymbolMatchFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => void; | ||
/** | ||
@@ -154,4 +138,3 @@ * Match jsdoc symbols in javascript text. | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachJsdocSymbol(txt: string, fn: JsdocSymbolMatchFunction): void; | ||
@@ -161,4 +144,3 @@ /** | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/JsdocSymbol) | ||
* */ | ||
*/ | ||
interface JsdocSymbol { | ||
@@ -183,4 +165,3 @@ /** Full jsdoc symbol match. */ | ||
* @returns jsdoc symbols | ||
* */ | ||
*/ | ||
declare function jsdocSymbols(txt: string): JsdocSymbol[]; | ||
@@ -197,5 +178,4 @@ /** | ||
* @returns updated jsdoc symbol | ||
* */ | ||
declare type JsdocSymbolReplaceFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => string; | ||
*/ | ||
type JsdocSymbolReplaceFunction = (full: string, jsdoc: string, name: string, kind: string, isExported: boolean, isDefault: boolean) => string; | ||
/** | ||
@@ -207,4 +187,3 @@ * Replace jsdoc symbols in javascript text. | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceJsdocSymbols(txt: string, fn: JsdocSymbolReplaceFunction): string; | ||
@@ -218,5 +197,4 @@ /** | ||
* @param isDefault symbol is default? | ||
* */ | ||
declare type ExportSymbolMatchFunction = (full: string, name: string, kind: string, isDefault: boolean) => void; | ||
*/ | ||
type ExportSymbolMatchFunction = (full: string, name: string, kind: string, isDefault: boolean) => void; | ||
/** | ||
@@ -227,4 +205,3 @@ * Match export symbols in javascript text. | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachExportSymbol(txt: string, fn: ExportSymbolMatchFunction): void; | ||
@@ -234,4 +211,3 @@ /** | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ExportSymbol) | ||
* */ | ||
*/ | ||
interface ExportSymbol { | ||
@@ -252,4 +228,3 @@ /** Full export symbol match. */ | ||
* @returns export symbols | ||
* */ | ||
*/ | ||
declare function exportSymbols(txt: string): ExportSymbol[]; | ||
@@ -264,5 +239,4 @@ /** | ||
* @returns updated export symbol | ||
* */ | ||
declare type ExportSymbolReplaceFunction = (full: string, name: string, kind: string, isDefault: boolean) => string; | ||
*/ | ||
type ExportSymbolReplaceFunction = (full: string, name: string, kind: string, isDefault: boolean) => string; | ||
/** | ||
@@ -274,4 +248,3 @@ * Replace export symbols in javascript text. | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceExportSymbols(txt: string, fn: ExportSymbolReplaceFunction): string; | ||
@@ -283,5 +256,4 @@ /** | ||
* @param file import file | ||
* */ | ||
declare type ImportSymbolMatchFunction = (full: string, file: string) => void; | ||
*/ | ||
type ImportSymbolMatchFunction = (full: string, file: string) => void; | ||
/** | ||
@@ -292,4 +264,3 @@ * Match import symbols in javascript text. | ||
* @param fn match function | ||
* */ | ||
*/ | ||
declare function forEachImportSymbol(txt: string, fn: ImportSymbolMatchFunction): void; | ||
@@ -299,4 +270,3 @@ /** | ||
* [📘](https://github.com/nodef/extra-javascript-text/wiki/ImportSymbol) | ||
* */ | ||
*/ | ||
interface ImportSymbol { | ||
@@ -313,4 +283,3 @@ /** Full import symbol match. */ | ||
* @returns export symbols | ||
* */ | ||
*/ | ||
declare function importSymbols(txt: string): ImportSymbol[]; | ||
@@ -323,5 +292,4 @@ /** | ||
* @returns updated import symbol | ||
* */ | ||
declare type ImportSymbolReplaceFunction = (full: string, file: string) => string; | ||
*/ | ||
type ImportSymbolReplaceFunction = (full: string, file: string) => string; | ||
/** | ||
@@ -333,4 +301,3 @@ * Replace import symbols in javascript text. | ||
* @returns updated javascript text | ||
* */ | ||
*/ | ||
declare function replaceImportSymbols(txt: string, fn: ImportSymbolReplaceFunction): string; | ||
@@ -343,6 +310,5 @@ /** | ||
* @returns corrected javascript text | ||
* */ | ||
*/ | ||
declare function correctDeclarations(txt: string, module?: string): string; | ||
export { CommentMatchFunction, CommentReplaceFunction, ExportSymbol, ExportSymbolMatchFunction, ExportSymbolReplaceFunction, ImportSymbol, ImportSymbolMatchFunction, ImportSymbolReplaceFunction, JsdocSymbol, JsdocSymbolMatchFunction, JsdocSymbolReplaceFunction, StringMatchFunction, StringReplaceFunction, comments, correctDeclarations, exportSymbols, forEachComment, forEachExportSymbol, forEachImportSymbol, forEachJsdocSymbol, forEachString, importSymbols, jsdocSymbols, replaceComments, replaceExportSymbols, replaceImportSymbols, replaceJsdocSymbols, replaceStrings, strings, tagComments, tagStrings, uncomment, untagComments, untagStrings }; |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_javascript_text=e()}}((function(){return function e(r,n,t){function o(s,l){if(!n[s]){if(!r[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(u)return u(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};r[s][0].call(c.exports,(function(e){return o(r[s][1][e]||e)}),c,c.exports,e,r,n,t)}return n[s].exports}for(var u="function"==typeof require&&require,s=0;s<t.length;s++)o(t[s]);return o}({1:[function(e,r,n){"use strict";function t(e,r){for(var n=e.charAt(r);;){var t=e.indexOf(n,r+1);if("\\"!=e.charAt(t-1))return t;r=t+1}}function o(e,r){for(var n=/\/\/|\/\*|(?:[=(]\s*)(\/[^\n]+\/[gimsuy]*)|['"`]/g,o=null;null!=(o=n.exec(e));){var u=o.index,s=0;"//"===o[0]?s=e.indexOf("\n",u+1):"/*"===o[0]?s=e.indexOf("*/",u+1):null!=o[1]?s=u+o[0].length:(s=t(e,u),r(e.substring(u,s+1))),n.lastIndex=s+1}}function u(e,r){for(var n=/\/\/|\/\*|['"`]/g,o=null,u="",s=0;null!=(o=n.exec(e));){var l=o.index,a=0;"//"===o[0]?a=e.indexOf("\n",l+1):"/*"===o[0]?a=e.indexOf("*/",l+1):(a=t(e,l),u+=e.substring(s,l)+r(e.substring(l,a+1)),s=a+1),n.lastIndex=a+1}return u+=e.substring(s)}function s(e){var r=new Map,n=-1;return[e=u(e,(e=>{var t="AUTO_STRING_"+ ++n;return r.set(t,e),`"${t}"`})),r]}function l(e,r){for(var[n,t]of r)e=e.replace(`"${n}"`,t);return e}Object.defineProperty(n,"__esModule",{value:!0});const a=/\/\/[\s\S]*?$|\/\*[\s\S]*?\*\//gm;function f(e,r){e=u(e,(()=>'"AUTO_STRING"'));for(var n=null;null!=(n=a.exec(e));)r(n[0])}function c(e,r){var[e,n]=s(e);return l(e=e.replace(a,r),n)}function i(e){var r=new Map,n=-1;return[e=c(e,(e=>{var t="AUTO_COMMENT_"+ ++n;return r.set(t,e),`/* ${t} */`})),r]}function p(e,r){for(var[n,t]of r)e=e.replace(`/* ${n} */`,t);return e}const d=/(\/\*\*[\s\S]*?\*\/)(?:\s+(?:(export)\s+(?:(default)\s+)?)?(?:declare\s+)?(type|enum|interface|const|var|let|(?:async\s+)?function\*?|class)\s+([\w$]+))?/g;function m(e,r){e=u(e,(()=>'"AUTO_STRING"'));for(var n=null;null!=(n=d.exec(e));)r(n[0],n[1]||"",n[5]||"",(n[4]||"").replace(/\s+/g," "),"export"===n[2],"default"===n[3])}const x=/export\s+\{\s*(?:(\S+)|(?:\S+\s+as\s+(\S+)))\s*\}|export\s+(?:(default)\s+)?(type|enum|interface|const|var|let|(?:async\s+)?function\*?|class)\s+([\w$]+)|export\s+(default)\s+([\w$]+)|module\s*\.\s*([\w$]+)|module\s*\[\s*['"`](.*?)['"`]\s*\]|(module)\s*\.\s*exports\s*=\s*\{(.*?)\}|(module)\s*\.\s*exports\s*=/g;function v(e,r){e=c(e=u(e,(()=>'"AUTO_STRING"')),(()=>"/* AUTO_COMMENT */"));for(var n=null;null!=(n=x.exec(e));)r(n[0],n[11]||n[9]||n[8]||n[7]||n[5]||n[2]||n[1]||"",(n[4]||"").replace(/\s+/g," "),"default"===(n[6]||n[3])||"module"===(n[12]||n[10]))}const g=/(?:import|export).*?from\s*['"`](.*?)['"`]|require\s*\(\s*['"`](.*?)['"`]\s*\)/g;function S(e,r){e=c(e=u(e,(()=>'"AUTO_STRING"')),(()=>"/* AUTO_COMMENT */"));for(var n=null;null!=(n=g.exec(e));)r(n[0],n[2]||n[1]||"")}n.comments=function(e){var r=[];return f(e,(e=>r.push(e))),r},n.correctDeclarations=function(e,r=null){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=(e=(e=e.replace(/export\s+declare/g,"export")).replace(/export\s+default\s+/,"export = ")).replace(/declare\s+module\s+['"`](.*?)['"`]/g,((e,n)=>null!=r?`declare module "${r}"`:e)),t),n)},n.exportSymbols=function(e){var r=[];return v(e,((e,n,t,o)=>{r.push({full:e,name:n,kind:t,isDefault:o})})),r},n.forEachComment=f,n.forEachExportSymbol=v,n.forEachImportSymbol=S,n.forEachJsdocSymbol=m,n.forEachString=o,n.importSymbols=function(e){var r=[];return S(e,((e,n)=>r.push({full:e,file:n}))),r},n.jsdocSymbols=function(e){var r=[];return m(e,((e,n,t,o,u,s)=>{r.push({full:e,jsdoc:n,name:t,kind:o,isExported:u,isDefault:s})})),r},n.replaceComments=c,n.replaceExportSymbols=function(e,r){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=e.replace(x,((e,n,t,o,u,s,l,a,f,c,i,p,d)=>r(e,p||c||f||a||s||t||n||"",(u||"").replace(/\s+/g," "),"default"===(l||o)||"module"===(d||i)))),t),n)},n.replaceImportSymbols=function(e,r){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=e.replace(g,((e,n,t)=>r(e,t||n||""))),t),n)},n.replaceJsdocSymbols=function(e,r){var[e,n]=s(e);return l(e=e.replace(d,((e,n,t,o,u,s)=>r(e,n||"",s||"",(u||"").replace(/\s+/g," "),"export"===t,"default"===o))),n)},n.replaceStrings=u,n.strings=function(e){var r=[];return o(e,(e=>r.push(e))),r},n.tagComments=i,n.tagStrings=s,n.uncomment=function(e,r=!1){return e=c(e,(()=>"")).replace(/[ \t]+$/gm,""),r&&(e=e.replace(/\n\n+/g,"\n")),e.trim()+"\n"},n.untagComments=p,n.untagStrings=l},{}]},{},[1])(1)})); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_javascript_text=e()}}((function(){return function e(r,n,t){function o(s,l){if(!n[s]){if(!r[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(u)return u(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[s]={exports:{}};r[s][0].call(c.exports,(function(e){return o(r[s][1][e]||e)}),c,c.exports,e,r,n,t)}return n[s].exports}for(var u="function"==typeof require&&require,s=0;s<t.length;s++)o(t[s]);return o}({1:[function(e,r,n){"use strict";function t(e,r){for(var n=e.charAt(r);;){var t=e.indexOf(n,r+1);if("\\"!=e.charAt(t-1))return t;r=t+1}}function o(e,r){for(var n=/\/\/|\/\*|(?:[=(]\s*)(\/[^\n]+\/[gimsuy]*)|['"`]/g,o=null;null!=(o=n.exec(e));){var u=o.index,s=0;"//"===o[0]?s=e.indexOf("\n",u+1):"/*"===o[0]?s=e.indexOf("*/",u+1):null!=o[1]?s=u+o[0].length:(s=t(e,u),r(e.substring(u,s+1))),n.lastIndex=s+1}}function u(e,r){for(var n=/\/\/|\/\*|['"`]/g,o=null,u="",s=0;null!=(o=n.exec(e));){var l=o.index,a=0;"//"===o[0]?a=e.indexOf("\n",l+1):"/*"===o[0]?a=e.indexOf("*/",l+1):(a=t(e,l),u+=e.substring(s,l)+r(e.substring(l,a+1)),s=a+1),n.lastIndex=a+1}return u+=e.substring(s)}function s(e){var r=new Map,n=-1;return[e=u(e,(e=>{var t="AUTO_STRING_"+ ++n;return r.set(t,e),`"${t}"`})),r]}function l(e,r){for(var[n,t]of r)e=e.replace(`"${n}"`,t);return e}const a=/\/\/[\s\S]*?$|\/\*[\s\S]*?\*\//gm;function f(e,r){e=u(e,(()=>'"AUTO_STRING"'));for(var n=null;null!=(n=a.exec(e));)r(n[0])}function c(e,r){var[e,n]=s(e);return l(e=e.replace(a,r),n)}function i(e){var r=new Map,n=-1;return[e=c(e,(e=>{var t="AUTO_COMMENT_"+ ++n;return r.set(t,e),`/* ${t} */`})),r]}function p(e,r){for(var[n,t]of r)e=e.replace(`/* ${n} */`,t);return e}const d=/(\/\*\*[\s\S]*?\*\/)(?:\s+(?:(export)\s+(?:(default)\s+)?)?(?:declare\s+)?(type|enum|interface|const|var|let|(?:async\s+)?function\*?|class)\s+([\w$]+))?/g;function m(e,r){e=u(e,(()=>'"AUTO_STRING"'));for(var n=null;null!=(n=d.exec(e));)r(n[0],n[1]||"",n[5]||"",(n[4]||"").replace(/\s+/g," "),"export"===n[2],"default"===n[3])}const x=/export\s+\{\s*(?:(\S+)|(?:\S+\s+as\s+(\S+)))\s*\}|export\s+(?:(default)\s+)?(type|enum|interface|const|var|let|(?:async\s+)?function\*?|class)\s+([\w$]+)|export\s+(default)\s+([\w$]+)|module\s*\.\s*([\w$]+)|module\s*\[\s*['"`](.*?)['"`]\s*\]|(module)\s*\.\s*exports\s*=\s*\{(.*?)\}|(module)\s*\.\s*exports\s*=/g;function v(e,r){e=c(e=u(e,(()=>'"AUTO_STRING"')),(()=>"/* AUTO_COMMENT */"));for(var n=null;null!=(n=x.exec(e));)r(n[0],n[11]||n[9]||n[8]||n[7]||n[5]||n[2]||n[1]||"",(n[4]||"").replace(/\s+/g," "),"default"===(n[6]||n[3])||"module"===(n[12]||n[10]))}const g=/(?:import|export).*?from\s*['"`](.*?)['"`]|require\s*\(\s*['"`](.*?)['"`]\s*\)/g;function S(e,r){e=c(e=u(e,(()=>'"AUTO_STRING"')),(()=>"/* AUTO_COMMENT */"));for(var n=null;null!=(n=g.exec(e));)r(n[0],n[2]||n[1]||"")}n.comments=function(e){var r=[];return f(e,(e=>r.push(e))),r},n.correctDeclarations=function(e,r=null){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=(e=(e=e.replace(/export\s+declare/g,"export")).replace(/export\s+default\s+/,"export = ")).replace(/declare\s+module\s+['"`](.*?)['"`]/g,((e,n)=>null!=r?`declare module "${r}"`:e)),t),n)},n.exportSymbols=function(e){var r=[];return v(e,((e,n,t,o)=>{r.push({full:e,name:n,kind:t,isDefault:o})})),r},n.forEachComment=f,n.forEachExportSymbol=v,n.forEachImportSymbol=S,n.forEachJsdocSymbol=m,n.forEachString=o,n.importSymbols=function(e){var r=[];return S(e,((e,n)=>r.push({full:e,file:n}))),r},n.jsdocSymbols=function(e){var r=[];return m(e,((e,n,t,o,u,s)=>{r.push({full:e,jsdoc:n,name:t,kind:o,isExported:u,isDefault:s})})),r},n.replaceComments=c,n.replaceExportSymbols=function(e,r){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=e.replace(x,((e,n,t,o,u,s,l,a,f,c,i,p,d)=>r(e,p||c||f||a||s||t||n||"",(u||"").replace(/\s+/g," "),"default"===(l||o)||"module"===(d||i)))),t),n)},n.replaceImportSymbols=function(e,r){var[e,n]=s(e),[e,t]=i(e);return e=l(e=p(e=e.replace(g,((e,n,t)=>r(e,t||n||""))),t),n)},n.replaceJsdocSymbols=function(e,r){var[e,n]=s(e);return l(e=e.replace(d,((e,n,t,o,u,s)=>r(e,n||"",s||"",(u||"").replace(/\s+/g," "),"export"===t,"default"===o))),n)},n.replaceStrings=u,n.strings=function(e){var r=[];return o(e,(e=>r.push(e))),r},n.tagComments=i,n.tagStrings=s,n.uncomment=function(e,r=!1){return e=c(e,(()=>"")).replace(/[ \t]+$/gm,""),r&&(e=e.replace(/\n\n+/g,"\n")),e.trim()+"\n"},n.untagComments=p,n.untagStrings=l},{}]},{},[1])(1)})); |
{ | ||
"name": "extra-javascript-text.web", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "Utilities for processing JavaScript text{web}.", | ||
@@ -68,9 +68,9 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^22.0.1", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@types/node": "^18.6.2", | ||
"extra-build": "^2.2.21", | ||
"@rollup/plugin-commonjs": "^24.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@types/node": "^18.11.18", | ||
"extra-build": "^2.2.40", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
"rollup-plugin-dts": "^4.2.2" | ||
"rollup-plugin-dts": "^5.1.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
28752