@intlayer/svelte-compiler 8.4.0 → 8.4.1
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.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/svelte-intlayer-extract-BD99Sgqc.cjs +3 -0
- package/dist/cjs/svelte-intlayer-extract-BD99Sgqc.cjs.map +1 -0
- package/dist/cjs/svelte-intlayer-extract.cjs +1 -3
- package/package.json +4 -4
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/cjs/svelte-intlayer-extract.cjs.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./svelte-intlayer-extract.cjs`);exports.intlayerSvelteExtract=e.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./svelte-intlayer-extract-BD99Sgqc.cjs`);exports.intlayerSvelteExtract=e.t,exports.processSvelteFile=e.n,exports.shouldProcessFile=e.r;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:fs`),l=require(`@babel/core`),u=require(`@intlayer/config/client`),d=require(`magic-string`);d=s(d);let f=require(`svelte/compiler`);const p=(e,t)=>{let n=null;try{let r=(0,l.parse)(e,{parserOpts:{sourceType:`module`,plugins:[`typescript`,`jsx`]}});if(!r)return null;(0,l.traverse)(r,{CallExpression(e){let r=e.node.callee;if(!l.types.isIdentifier(r)||r.name!==`useIntlayer`&&r.name!==`getIntlayer`)return;let i=e.parent;if(l.types.isVariableDeclarator(i)&&l.types.isObjectPattern(i.id)){let e=i.id.properties,r=e.filter(e=>l.types.isObjectProperty(e)&&l.types.isIdentifier(e.key)).map(e=>e.key.name),a=e[e.length-1];n={isDestructured:!0,variableName:`content`,existingDestructuredKeys:r,closingBraceAbsolutePos:t+(i.id.end-1),lastPropAbsoluteEnd:t+a.end}}else n={isDestructured:!1,variableName:l.types.isVariableDeclarator(i)&&l.types.isIdentifier(i.id)?i.id.name:`content`,existingDestructuredKeys:[],closingBraceAbsolutePos:-1,lastPropAbsoluteEnd:-1};e.stop()}})}catch{}return n},m=(e,t)=>{if(!e)return!1;if(!t||t.length===0)return!0;let n=e.replace(/\\/g,`/`);return t.some(e=>e.replace(/\\/g,`/`)===n)},h=(e,t,n={})=>{let{defaultLocale:r=u.DefaultValues.Internationalization.DEFAULT_LOCALE,packageName:i=`svelte-intlayer`,filesList:a,shouldExtract:o,onExtract:s,dictionaryKey:c,attributesToExtract:h=[],extractDictionaryKeyFromPath:g,generateKey:_}=n;if(!m(t,a)||!t.endsWith(`.svelte`))return null;let v=new d.default(e),y={},b=new Set,x=c??g?.(t)??``,S=[],C=/<script[^>]*>([\s\S]*?)<\/script>/.exec(e),w=!1,T=C?C[1]:``,E=C?p(T,C.index+C[0].indexOf(`>`)+1):null,D=E?.isDestructured??!1,O=E?.variableName??`content`,k;try{k=(0,f.parse)(e)}catch(e){return console.warn(`Svelte extraction: Failed to parse Svelte AST for ${t}`,e),null}let A=e=>e.type===`Text`||e.type===3,j=e=>e.type===`Attribute`||e.type===6,M=e=>e.type===`MustacheTag`||e.type===8||e.type===`ExpressionTag`,N=t=>{if(A(t)){let e=t.data??t.content??``;if(o?.(e)&&_){let n=_(e,b);b.add(n);let r=D?n:`$${O}.${n}`;S.push({start:t.start,end:t.end,replacement:`{${r}}`,key:n,value:e.replace(/\s+/g,` `).trim()})}}else if(j(t)&&h.includes(t.name)&&t.value&&t.value.length===1&&A(t.value[0])){let e=t.value[0].data??t.value[0].content??``;if(o?.(e)&&_){let n=_(e,b);b.add(n);let r=D?n:`$${O}.${n}`;S.push({start:t.start,end:t.end,replacement:`${t.name}={${r}}`,key:n,value:e.trim()})}}let n=t.children??t.fragment?.nodes??t.fragment?.children;if(n?.some(M)){let r=[],i=!1,a=!0;for(let t of n)if(A(t)){let e=t.data??t.content??``;e.trim().length>0&&(i=!0),r.push({type:`text`,value:e,originalExpr:``})}else if(M(t)){let n=e.slice(t.start+1,t.end-1).trim(),i=n.includes(`.`)?n.split(`.`).pop().replace(/[^\w$]/g,``):n;r.push({type:`var`,value:i,originalExpr:n})}else{a=!1;break}if(a&&i&&r.some(e=>e.type===`var`)){let e=``;for(let t of r)e+=t.type===`var`?`{{${t.value}}}`:t.value;let i=e.replace(/\s+/g,` `).trim();if(o?.(i)&&_){let e=_(i,b);b.add(e);let a=`{${D?e:`$${O}.${e}`}({ ${[...new Set(r.filter(e=>e.type===`var`).map(e=>`${e.value}: ${e.originalExpr}`))].join(`, `)} })}`,o=n[0],s=n[n.length-1];S.push({start:o.start,end:s.end,replacement:a,key:e,value:i}),t.attributes&&t.attributes.forEach(N);return}}}n&&n.forEach(N),t.attributes&&t.attributes.forEach(N)};if(k.html&&N(k.html),C){let e=C[0].indexOf(`>`)+1,n=C.index+e;try{let e=(0,l.parse)(T,{parserOpts:{sourceType:`module`,plugins:[`typescript`,`jsx`]}});e&&(0,l.traverse)(e,{StringLiteral(e){if(e.parentPath.isImportDeclaration()||e.parentPath.isExportDeclaration()||e.parentPath.isImportSpecifier()||e.parentPath.isObjectProperty()&&e.key===`key`)return;if(e.parentPath.isCallExpression()){let t=e.parentPath.node.callee;if(l.types.isMemberExpression(t)&&l.types.isIdentifier(t.object)&&t.object.name===`console`||l.types.isIdentifier(t)&&(t.name===`useIntlayer`||t.name===`t`)||t.type===`Import`||l.types.isIdentifier(t)&&t.name===`require`)return}let t=e.node.value;if(o?.(t)&&_){let r=_(t,b);if(b.add(r),w=!0,e.node.start!=null&&e.node.end!=null){let i=D?r:`get(${O}).${r}`;S.push({start:n+e.node.start,end:n+e.node.end,replacement:i,key:r,value:t.trim()})}}}})}catch(e){console.warn(`Svelte extraction: Failed to parse script content for ${t}`,e)}}if(S.length===0)return null;S.sort((e,t)=>t.start-e.start);for(let{start:e,end:t,replacement:n,key:r,value:i}of S)v.overwrite(e,t,n),y[r]=i;if(E?.isDestructured&&E.closingBraceAbsolutePos>=0){let e=Object.keys(y).filter(e=>!E.existingDestructuredKeys.includes(e));e.length>0&&v.appendLeft(E.lastPropAbsoluteEnd,`, ${e.join(`, `)}`)}let P=/import\s*{[^}]*useIntlayer[^}]*}\s*from\s*['"][^'"]+['"]/.test(T)||/import\s+useIntlayer\s+from\s*['"][^'"]+['"]/.test(T),F=/import\s*{[^}]*get[^}]*}\s*from\s*['"]svelte\/store['"]/.test(T),I=E!==null||/const\s+content\s*=\s*useIntlayer\s*\(/.test(T),L=P?``:`import { useIntlayer } from '${i}';`,R=w&&!D&&!F?`import { get } from 'svelte/store';`:``,z=I?``:`const content = useIntlayer('${x}');`,B=[L,R,z].filter(Boolean);if(B.length>0){let e=`\n ${B.join(`
|
|
2
|
+
`)}\n`;if(C){let t=C.index+C[0].indexOf(`>`)+1;v.appendLeft(t,e)}else v.prepend(`<script>\n ${L}\n ${w?`import { get } from 'svelte/store';`:``}\n ${z}\n<\/script>\n\n`)}return s&&s({dictionaryKey:x,filePath:t,content:y,locale:r}),{code:v.toString(),map:v.generateMap({source:t,includeContent:!0}),extracted:!0}},g=(e,t,n,r,i=!0)=>{let a=(0,c.readFileSync)(e,`utf-8`),o=null,s=h(a,e,{packageName:n,dictionaryKey:t,shouldExtract:r.shouldExtract,generateKey:r.generateKey,extractDictionaryKeyFromPath:r.extractDictionaryKeyFromPath,attributesToExtract:r.attributesToExtract,onExtract:e=>{o=e.content}});return s?(i&&(0,c.writeFileSync)(e,s.code),{extractedContent:o,code:s.code,map:s.map}):null};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|
|
3
|
+
//# sourceMappingURL=svelte-intlayer-extract-BD99Sgqc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svelte-intlayer-extract-BD99Sgqc.cjs","names":["t","DefaultValues","MagicString"],"sources":["../../src/svelte-intlayer-extract.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { parse as babelParse, types as t, traverse } from '@babel/core';\nimport { DefaultValues } from '@intlayer/config/client';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport MagicString from 'magic-string';\nimport { parse } from 'svelte/compiler';\n\ntype ExistingCallInfo = {\n isDestructured: boolean;\n existingDestructuredKeys: string[];\n /** The variable name used to store the call result (e.g. `t` in `const t = useIntlayer(...)`) */\n variableName: string;\n /** Absolute position of `}` in the full file — only valid when `isDestructured` */\n closingBraceAbsolutePos: number;\n /** Absolute position of end of last property — only valid when `isDestructured` */\n lastPropAbsoluteEnd: number;\n} | null;\n\n/**\n * Detects whether a script block already contains a `useIntlayer` /\n * `getIntlayer` call and whether its result is destructured.\n */\nconst detectExistingIntlayerCall = (\n scriptText: string,\n absoluteOffset: number\n): ExistingCallInfo => {\n let info: ExistingCallInfo = null;\n\n try {\n const ast = babelParse(scriptText, {\n parserOpts: { sourceType: 'module', plugins: ['typescript', 'jsx'] },\n });\n\n if (!ast) return null;\n\n traverse(ast, {\n CallExpression(path: any) {\n const callee = path.node.callee;\n\n if (\n !t.isIdentifier(callee) ||\n (callee.name !== 'useIntlayer' && callee.name !== 'getIntlayer')\n )\n return;\n\n const parent = path.parent;\n\n if (t.isVariableDeclarator(parent) && t.isObjectPattern(parent.id)) {\n const properties = parent.id.properties;\n const existingDestructuredKeys = properties\n .filter(\n (p: any): p is typeof t.objectProperty =>\n t.isObjectProperty(p) && t.isIdentifier(p.key)\n )\n .map((p: any) => (p.key as any).name as string);\n const lastProp = properties[properties.length - 1];\n\n info = {\n isDestructured: true,\n variableName: 'content',\n existingDestructuredKeys,\n closingBraceAbsolutePos: absoluteOffset + (parent.id.end! - 1),\n lastPropAbsoluteEnd: absoluteOffset + lastProp.end!,\n };\n } else {\n const variableName =\n t.isVariableDeclarator(parent) && t.isIdentifier(parent.id)\n ? parent.id.name\n : 'content';\n\n info = {\n isDestructured: false,\n variableName,\n existingDestructuredKeys: [],\n closingBraceAbsolutePos: -1,\n lastPropAbsoluteEnd: -1,\n };\n }\n\n path.stop();\n },\n });\n } catch {\n // Silently ignore parse failures — fall back to no-info\n }\n\n return info;\n};\n\nexport type ExtractedContent = Record<string, string>;\n\nexport type ExtractResult = {\n dictionaryKey: string;\n filePath: string;\n content: ExtractedContent;\n locale: Locale;\n};\n\nexport type ExtractPluginOptions = {\n defaultLocale?: Locale;\n packageName?: string;\n filesList?: string[];\n shouldExtract?: (text: string) => boolean;\n onExtract?: (result: ExtractResult) => void;\n dictionaryKey?: string;\n attributesToExtract?: readonly string[];\n extractDictionaryKeyFromPath?: (path: string) => string;\n generateKey?: (text: string, existingKeys: Set<string>) => string;\n};\n\ntype Replacement = {\n start: number;\n end: number;\n replacement: string;\n key: string;\n value: string;\n};\n\n/* ────────────────────────────────────────── helpers ─────────────────────── */\n\nexport const shouldProcessFile = (\n filename: string | undefined,\n filesList?: string[]\n): boolean => {\n if (!filename) return false;\n if (!filesList || filesList.length === 0) return true;\n\n const normalizedFilename = filename.replace(/\\\\/g, '/');\n return filesList.some((f) => {\n const normalizedF = f.replace(/\\\\/g, '/');\n return normalizedF === normalizedFilename;\n });\n};\n\n/* ────────────────────────────────────────── plugin ──────────────────────── */\n\nexport const intlayerSvelteExtract = (\n code: string,\n filename: string,\n options: ExtractPluginOptions = {}\n): { code: string; map?: unknown; extracted: boolean } | null => {\n const {\n defaultLocale = DefaultValues.Internationalization.DEFAULT_LOCALE,\n packageName = 'svelte-intlayer',\n filesList,\n shouldExtract,\n onExtract,\n dictionaryKey: dictionaryKeyOption,\n attributesToExtract = [],\n extractDictionaryKeyFromPath,\n generateKey,\n } = options;\n\n if (!shouldProcessFile(filename, filesList)) return null;\n if (!filename.endsWith('.svelte')) return null;\n\n const magic = new MagicString(code);\n const extractedContent: ExtractedContent = {};\n const existingKeys = new Set<string>();\n const dictionaryKey =\n dictionaryKeyOption ?? extractDictionaryKeyFromPath?.(filename) ?? '';\n const replacements: Replacement[] = [];\n\n // Extract and walk Script using Babel\n const scriptRegex = /<script[^>]*>([\\s\\S]*?)<\\/script>/;\n const scriptMatch = scriptRegex.exec(code);\n let hasScriptExtraction = false;\n const scriptContent = scriptMatch ? scriptMatch[1] : '';\n\n // Detect existing call BEFORE walking the template so the access pattern\n // (bare key vs. $content.key) can be chosen consistently.\n const existingCallInfo = scriptMatch\n ? detectExistingIntlayerCall(\n scriptContent,\n scriptMatch.index + scriptMatch[0].indexOf('>') + 1\n )\n : null;\n\n const isDestructured = existingCallInfo?.isDestructured ?? false;\n const varName = existingCallInfo?.variableName ?? 'content';\n\n let ast: any;\n try {\n ast = parse(code);\n } catch (e) {\n console.warn(\n `Svelte extraction: Failed to parse Svelte AST for ${filename}`,\n e\n );\n return null;\n }\n\n // Walk Svelte HTML AST.\n // Svelte 4 used numeric type constants; Svelte 5 uses string type names.\n // We check for both to remain compatible.\n const isTextNode = (node: any) => node.type === 'Text' || node.type === 3;\n const isAttributeNode = (node: any) =>\n node.type === 'Attribute' || node.type === 6;\n const isExpressionTagNode = (node: any): boolean =>\n node.type === 'MustacheTag' ||\n node.type === 8 || // Svelte 4 numeric\n node.type === 'ExpressionTag'; // Svelte 5\n\n const walkSvelte = (node: any) => {\n if (isTextNode(node)) {\n const text = node.data ?? node.content ?? '';\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n // Destructured: each property is a plain value → `{key}`.\n // Otherwise use the reactive store subscription `{$content.key}`.\n const ref = isDestructured ? key : `$${varName}.${key}`;\n replacements.push({\n start: node.start,\n end: node.end,\n replacement: `{${ref}}`,\n key,\n value: text.replace(/\\s+/g, ' ').trim(),\n });\n }\n } else if (\n isAttributeNode(node) &&\n (attributesToExtract as readonly string[]).includes(node.name)\n ) {\n if (node.value && node.value.length === 1 && isTextNode(node.value[0])) {\n const text = node.value[0].data ?? node.value[0].content ?? '';\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n const ref = isDestructured ? key : `$${varName}.${key}`;\n replacements.push({\n start: node.start,\n end: node.end,\n replacement: `${node.name}={${ref}}`,\n key,\n value: text.trim(),\n });\n }\n }\n }\n\n const children =\n node.children ?? node.fragment?.nodes ?? node.fragment?.children;\n\n // Try to handle mixed text + expression children as an insertion\n if (children?.some(isExpressionTagNode)) {\n const parts: {\n type: 'text' | 'var';\n value: string;\n originalExpr: string;\n }[] = [];\n let hasSignificantText = false;\n let isValid = true;\n\n for (const child of children) {\n if (isTextNode(child)) {\n const text = child.data ?? child.content ?? '';\n if (text.trim().length > 0) hasSignificantText = true;\n parts.push({ type: 'text', value: text, originalExpr: '' });\n } else if (isExpressionTagNode(child)) {\n // Source slice: skip the leading `{` and trailing `}`\n const exprCode = code.slice(child.start + 1, child.end - 1).trim();\n const varName = exprCode.includes('.')\n ? exprCode\n .split('.')\n .pop()!\n .replace(/[^\\w$]/g, '')\n : exprCode;\n parts.push({ type: 'var', value: varName, originalExpr: exprCode });\n } else {\n isValid = false;\n break;\n }\n }\n\n if (\n isValid &&\n hasSignificantText &&\n parts.some((p) => p.type === 'var')\n ) {\n let combined = '';\n for (const p of parts) {\n combined += p.type === 'var' ? `{{${p.value}}}` : p.value;\n }\n const cleanString = combined.replace(/\\s+/g, ' ').trim();\n\n if (shouldExtract?.(cleanString) && generateKey) {\n const key = generateKey(cleanString, existingKeys);\n existingKeys.add(key);\n const ref = isDestructured ? key : `$${varName}.${key}`;\n\n const uniqueVarPairs = [\n ...new Set(\n parts\n .filter((p) => p.type === 'var')\n .map((p) => `${p.value}: ${p.originalExpr}`)\n ),\n ];\n const varArgs = uniqueVarPairs.join(', ');\n const replacement = `{${ref}({ ${varArgs} })}`;\n\n const firstChild = children[0];\n const lastChild = children[children.length - 1];\n replacements.push({\n start: firstChild.start,\n end: lastChild.end,\n replacement,\n key,\n value: cleanString,\n });\n\n // Don't recurse into these children\n if (node.attributes) node.attributes.forEach(walkSvelte);\n return;\n }\n }\n }\n\n if (children) children.forEach(walkSvelte);\n if (node.attributes) node.attributes.forEach(walkSvelte);\n };\n\n if (ast.html) {\n walkSvelte(ast.html);\n }\n\n if (scriptMatch) {\n const openTagEndIndex = scriptMatch[0].indexOf('>') + 1;\n const offset = scriptMatch.index + openTagEndIndex;\n\n try {\n const babelAst = babelParse(scriptContent, {\n parserOpts: {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n },\n });\n\n if (babelAst) {\n traverse(babelAst, {\n StringLiteral(path: any) {\n if (path.parentPath.isImportDeclaration()) return;\n if (path.parentPath.isExportDeclaration()) return;\n if (path.parentPath.isImportSpecifier()) return;\n if (path.parentPath.isObjectProperty() && path.key === 'key')\n return;\n\n if (path.parentPath.isCallExpression()) {\n const callee = path.parentPath.node.callee;\n if (\n t.isMemberExpression(callee) &&\n t.isIdentifier(callee.object) &&\n callee.object.name === 'console'\n )\n return;\n\n if (\n t.isIdentifier(callee) &&\n (callee.name === 'useIntlayer' || callee.name === 't')\n )\n return;\n\n if (callee.type === 'Import') return;\n if (t.isIdentifier(callee) && callee.name === 'require') return;\n }\n\n const text = path.node.value;\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n hasScriptExtraction = true;\n\n if (path.node.start != null && path.node.end != null) {\n // Destructured: each property is a plain value → access directly.\n // Otherwise use `get(content).key` to read the Svelte store.\n const ref = isDestructured ? key : `get(${varName}).${key}`;\n replacements.push({\n start: offset + path.node.start,\n end: offset + path.node.end,\n replacement: ref,\n key,\n value: text.trim(),\n });\n }\n }\n },\n });\n }\n } catch (error) {\n console.warn(\n `Svelte extraction: Failed to parse script content for ${filename}`,\n error\n );\n }\n }\n\n // Abort if nothing was extracted\n if (replacements.length === 0) return null;\n\n // Apply Replacements in Reverse Order (prevents magic-string chunk errors)\n replacements.sort((a, b) => b.start - a.start);\n for (const { start, end, replacement, key, value } of replacements) {\n magic.overwrite(start, end, replacement);\n extractedContent[key] = value;\n }\n\n // When the existing call is destructured, inject only the missing keys into\n // the ObjectPattern — no new `content` variable is needed.\n if (\n existingCallInfo?.isDestructured &&\n existingCallInfo.closingBraceAbsolutePos >= 0\n ) {\n const missingKeys = Object.keys(extractedContent).filter(\n (k) => !existingCallInfo.existingDestructuredKeys.includes(k)\n );\n\n if (missingKeys.length > 0) {\n // Insert right after the last property so the space/newline before `}`\n // is naturally preserved: `{ a }` → `{ a, b }`.\n magic.appendLeft(\n existingCallInfo.lastPropAbsoluteEnd,\n `, ${missingKeys.join(', ')}`\n );\n }\n }\n\n // Inject necessary imports and setup\n const hasUseIntlayerImport =\n /import\\s*{[^}]*useIntlayer[^}]*}\\s*from\\s*['\"][^'\"]+['\"]/.test(\n scriptContent\n ) || /import\\s+useIntlayer\\s+from\\s*['\"][^'\"]+['\"]/.test(scriptContent);\n\n const hasGetImport =\n /import\\s*{[^}]*get[^}]*}\\s*from\\s*['\"]svelte\\/store['\"]/.test(\n scriptContent\n );\n\n // An existing call (destructured or not) means no new declaration is needed.\n const hasContentDeclaration =\n existingCallInfo !== null ||\n /const\\s+content\\s*=\\s*useIntlayer\\s*\\(/.test(scriptContent);\n\n const importStmt = hasUseIntlayerImport\n ? ''\n : `import { useIntlayer } from '${packageName}';`;\n const getImportStmt =\n hasScriptExtraction && !isDestructured && !hasGetImport\n ? `import { get } from 'svelte/store';`\n : '';\n const contentDecl = hasContentDeclaration\n ? ''\n : `const content = useIntlayer('${dictionaryKey}');`;\n\n const injectionParts = [importStmt, getImportStmt, contentDecl].filter(\n Boolean\n );\n\n if (injectionParts.length > 0) {\n const injection = `\\n ${injectionParts.join('\\n ')}\\n`;\n\n if (scriptMatch) {\n const scriptContentStart =\n scriptMatch.index + scriptMatch[0].indexOf('>') + 1;\n magic.appendLeft(scriptContentStart, injection);\n } else {\n magic.prepend(\n `<script>\\n ${importStmt}\\n ${hasScriptExtraction ? \"import { get } from 'svelte/store';\" : ''}\\n ${contentDecl}\\n</script>\\n\\n`\n );\n }\n }\n\n if (onExtract) {\n onExtract({\n dictionaryKey,\n filePath: filename,\n content: extractedContent,\n locale: defaultLocale,\n });\n }\n\n return {\n code: magic.toString(),\n map: magic.generateMap({ source: filename, includeContent: true }),\n extracted: true,\n };\n};\n\ntype Tools = {\n generateKey: (text: string, existingKeys: Set<string>) => string;\n shouldExtract: (text: string) => boolean;\n extractDictionaryKeyFromPath: (path: string) => string;\n attributesToExtract: readonly string[];\n extractTsContent: any;\n};\n\nexport const processSvelteFile = (\n filePath: string,\n _componentKey: string,\n packageName: string,\n tools: Tools,\n save: boolean = true\n): {\n extractedContent: Record<string, string>;\n code: string;\n map?: any;\n} | null => {\n const code = readFileSync(filePath, 'utf-8');\n let extractedContent: Record<string, string> | null = null;\n\n const result = intlayerSvelteExtract(code, filePath, {\n packageName,\n dictionaryKey: _componentKey,\n shouldExtract: tools.shouldExtract,\n generateKey: tools.generateKey,\n extractDictionaryKeyFromPath: tools.extractDictionaryKeyFromPath,\n attributesToExtract: tools.attributesToExtract,\n onExtract: (extractResult) => {\n extractedContent = extractResult.content;\n },\n });\n\n if (!result) return null;\n\n if (save) {\n writeFileSync(filePath, result.code);\n }\n\n return {\n extractedContent: extractedContent!,\n code: result.code,\n map: result.map,\n };\n};\n"],"mappings":"unBAsBA,MAAM,GACJ,EACA,IACqB,CACrB,IAAI,EAAyB,KAE7B,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,OAAiB,EAAY,CACj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gC,EAAY,IAC1C,EACJ,GAAuB,CAAC,GAAkB,CAAC,EACvC,sCACA,GACA,EAAc,EAChB,GACA,gCAAgC,EAAc,KAE5C,EAAiB,CAAC,EAAY,EAAe,EAAY,CAAC,OAC9D,QACD,CAED,GAAI,EAAe,OAAS,EAAG,CAC7B,IAAM,EAAY,OAAO,EAAe,KAAK;IAAO,CAAC,IAErD,GAAI,EAAa,CACf,IAAM,EACJ,EAAY,MAAQ,EAAY,GAAG,QAAQ,IAAI,CAAG,EACpD,EAAM,WAAW,EAAoB,EAAU,MAE/C,EAAM,QACJ,eAAe,EAAW,MAAM,EAAsB,sCAAwC,GAAG,MAAM,EAAY,kBACpH,CAaL,OATI,GACF,EAAU,CACR,gBACA,SAAU,EACV,QAAS,EACT,OAAQ,EACT,CAAC,CAGG,CACL,KAAM,EAAM,UAAU,CACtB,IAAK,EAAM,YAAY,CAAE,OAAQ,EAAU,eAAgB,GAAM,CAAC,CAClE,UAAW,GACZ,EAWU,GACX,EACA,EACA,EACA,EACA,EAAgB,KAKN,CACV,IAAM,GAAA,EAAA,EAAA,cAAoB,EAAU,QAAQ,CACxC,EAAkD,KAEhD,EAAS,EAAsB,EAAM,EAAU,CACnD,cACA,cAAe,EACf,cAAe,EAAM,cACrB,YAAa,EAAM,YACnB,6BAA8B,EAAM,6BACpC,oBAAqB,EAAM,oBAC3B,UAAY,GAAkB,CAC5B,EAAmB,EAAc,SAEpC,CAAC,CAQF,OANK,GAED,IACF,EAAA,EAAA,eAAc,EAAU,EAAO,KAAK,CAG/B,CACa,mBAClB,KAAM,EAAO,KACb,IAAK,EAAO,IACb,EAVmB"}
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./
|
|
2
|
-
`)}\n`;if(C){let t=C.index+C[0].indexOf(`>`)+1;v.appendLeft(t,e)}else v.prepend(`<script>\n ${L}\n ${w?`import { get } from 'svelte/store';`:``}\n ${z}\n<\/script>\n\n`)}return p&&p({dictionaryKey:x,filePath:t,content:y,locale:l}),{code:v.toString(),map:v.generateMap({source:t,includeContent:!0}),extracted:!0}},l=(e,n,r,i,a=!0)=>{let o=(0,t.readFileSync)(e,`utf-8`),s=null,l=c(o,e,{packageName:r,dictionaryKey:n,shouldExtract:i.shouldExtract,generateKey:i.generateKey,extractDictionaryKeyFromPath:i.extractDictionaryKeyFromPath,attributesToExtract:i.attributesToExtract,onExtract:e=>{s=e.content}});return l?(a&&(0,t.writeFileSync)(e,l.code),{extractedContent:s,code:l.code,map:l.map}):null};exports.intlayerSvelteExtract=c,exports.processSvelteFile=l,exports.shouldProcessFile=s;
|
|
3
|
-
//# sourceMappingURL=svelte-intlayer-extract.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./svelte-intlayer-extract-BD99Sgqc.cjs`);exports.intlayerSvelteExtract=e.t,exports.processSvelteFile=e.n,exports.shouldProcessFile=e.r;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/svelte-compiler",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vite-compatible compiler plugin for Svelte with Intlayer, providing HMR support, file transformation, and optimized dictionary loading for Svelte applications.",
|
|
6
6
|
"keywords": [
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@babel/core": "7.29.0",
|
|
84
|
-
"@intlayer/types": "8.4.
|
|
84
|
+
"@intlayer/types": "8.4.1",
|
|
85
85
|
"fast-glob": "3.3.3",
|
|
86
86
|
"magic-string": "0.30.21"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@intlayer/config": "8.4.
|
|
90
|
-
"@intlayer/types": "8.4.
|
|
89
|
+
"@intlayer/config": "8.4.1",
|
|
90
|
+
"@intlayer/types": "8.4.1",
|
|
91
91
|
"@types/babel__core": "7.20.5",
|
|
92
92
|
"@types/babel__generator": "7.27.0",
|
|
93
93
|
"@types/babel__traverse": "7.28.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"svelte-intlayer-extract.cjs","names":["t","DefaultValues","MagicString"],"sources":["../../src/svelte-intlayer-extract.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'node:fs';\nimport { parse as babelParse, types as t, traverse } from '@babel/core';\nimport { DefaultValues } from '@intlayer/config/client';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport MagicString from 'magic-string';\nimport { parse } from 'svelte/compiler';\n\ntype ExistingCallInfo = {\n isDestructured: boolean;\n existingDestructuredKeys: string[];\n /** The variable name used to store the call result (e.g. `t` in `const t = useIntlayer(...)`) */\n variableName: string;\n /** Absolute position of `}` in the full file — only valid when `isDestructured` */\n closingBraceAbsolutePos: number;\n /** Absolute position of end of last property — only valid when `isDestructured` */\n lastPropAbsoluteEnd: number;\n} | null;\n\n/**\n * Detects whether a script block already contains a `useIntlayer` /\n * `getIntlayer` call and whether its result is destructured.\n */\nconst detectExistingIntlayerCall = (\n scriptText: string,\n absoluteOffset: number\n): ExistingCallInfo => {\n let info: ExistingCallInfo = null;\n\n try {\n const ast = babelParse(scriptText, {\n parserOpts: { sourceType: 'module', plugins: ['typescript', 'jsx'] },\n });\n\n if (!ast) return null;\n\n traverse(ast, {\n CallExpression(path: any) {\n const callee = path.node.callee;\n\n if (\n !t.isIdentifier(callee) ||\n (callee.name !== 'useIntlayer' && callee.name !== 'getIntlayer')\n )\n return;\n\n const parent = path.parent;\n\n if (t.isVariableDeclarator(parent) && t.isObjectPattern(parent.id)) {\n const properties = parent.id.properties;\n const existingDestructuredKeys = properties\n .filter(\n (p: any): p is typeof t.objectProperty =>\n t.isObjectProperty(p) && t.isIdentifier(p.key)\n )\n .map((p: any) => (p.key as any).name as string);\n const lastProp = properties[properties.length - 1];\n\n info = {\n isDestructured: true,\n variableName: 'content',\n existingDestructuredKeys,\n closingBraceAbsolutePos: absoluteOffset + (parent.id.end! - 1),\n lastPropAbsoluteEnd: absoluteOffset + lastProp.end!,\n };\n } else {\n const variableName =\n t.isVariableDeclarator(parent) && t.isIdentifier(parent.id)\n ? parent.id.name\n : 'content';\n\n info = {\n isDestructured: false,\n variableName,\n existingDestructuredKeys: [],\n closingBraceAbsolutePos: -1,\n lastPropAbsoluteEnd: -1,\n };\n }\n\n path.stop();\n },\n });\n } catch {\n // Silently ignore parse failures — fall back to no-info\n }\n\n return info;\n};\n\nexport type ExtractedContent = Record<string, string>;\n\nexport type ExtractResult = {\n dictionaryKey: string;\n filePath: string;\n content: ExtractedContent;\n locale: Locale;\n};\n\nexport type ExtractPluginOptions = {\n defaultLocale?: Locale;\n packageName?: string;\n filesList?: string[];\n shouldExtract?: (text: string) => boolean;\n onExtract?: (result: ExtractResult) => void;\n dictionaryKey?: string;\n attributesToExtract?: readonly string[];\n extractDictionaryKeyFromPath?: (path: string) => string;\n generateKey?: (text: string, existingKeys: Set<string>) => string;\n};\n\ntype Replacement = {\n start: number;\n end: number;\n replacement: string;\n key: string;\n value: string;\n};\n\n/* ────────────────────────────────────────── helpers ─────────────────────── */\n\nexport const shouldProcessFile = (\n filename: string | undefined,\n filesList?: string[]\n): boolean => {\n if (!filename) return false;\n if (!filesList || filesList.length === 0) return true;\n\n const normalizedFilename = filename.replace(/\\\\/g, '/');\n return filesList.some((f) => {\n const normalizedF = f.replace(/\\\\/g, '/');\n return normalizedF === normalizedFilename;\n });\n};\n\n/* ────────────────────────────────────────── plugin ──────────────────────── */\n\nexport const intlayerSvelteExtract = (\n code: string,\n filename: string,\n options: ExtractPluginOptions = {}\n): { code: string; map?: unknown; extracted: boolean } | null => {\n const {\n defaultLocale = DefaultValues.Internationalization.DEFAULT_LOCALE,\n packageName = 'svelte-intlayer',\n filesList,\n shouldExtract,\n onExtract,\n dictionaryKey: dictionaryKeyOption,\n attributesToExtract = [],\n extractDictionaryKeyFromPath,\n generateKey,\n } = options;\n\n if (!shouldProcessFile(filename, filesList)) return null;\n if (!filename.endsWith('.svelte')) return null;\n\n const magic = new MagicString(code);\n const extractedContent: ExtractedContent = {};\n const existingKeys = new Set<string>();\n const dictionaryKey =\n dictionaryKeyOption ?? extractDictionaryKeyFromPath?.(filename) ?? '';\n const replacements: Replacement[] = [];\n\n // Extract and walk Script using Babel\n const scriptRegex = /<script[^>]*>([\\s\\S]*?)<\\/script>/;\n const scriptMatch = scriptRegex.exec(code);\n let hasScriptExtraction = false;\n const scriptContent = scriptMatch ? scriptMatch[1] : '';\n\n // Detect existing call BEFORE walking the template so the access pattern\n // (bare key vs. $content.key) can be chosen consistently.\n const existingCallInfo = scriptMatch\n ? detectExistingIntlayerCall(\n scriptContent,\n scriptMatch.index + scriptMatch[0].indexOf('>') + 1\n )\n : null;\n\n const isDestructured = existingCallInfo?.isDestructured ?? false;\n const varName = existingCallInfo?.variableName ?? 'content';\n\n let ast: any;\n try {\n ast = parse(code);\n } catch (e) {\n console.warn(\n `Svelte extraction: Failed to parse Svelte AST for ${filename}`,\n e\n );\n return null;\n }\n\n // Walk Svelte HTML AST.\n // Svelte 4 used numeric type constants; Svelte 5 uses string type names.\n // We check for both to remain compatible.\n const isTextNode = (node: any) => node.type === 'Text' || node.type === 3;\n const isAttributeNode = (node: any) =>\n node.type === 'Attribute' || node.type === 6;\n const isExpressionTagNode = (node: any): boolean =>\n node.type === 'MustacheTag' ||\n node.type === 8 || // Svelte 4 numeric\n node.type === 'ExpressionTag'; // Svelte 5\n\n const walkSvelte = (node: any) => {\n if (isTextNode(node)) {\n const text = node.data ?? node.content ?? '';\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n // Destructured: each property is a plain value → `{key}`.\n // Otherwise use the reactive store subscription `{$content.key}`.\n const ref = isDestructured ? key : `$${varName}.${key}`;\n replacements.push({\n start: node.start,\n end: node.end,\n replacement: `{${ref}}`,\n key,\n value: text.replace(/\\s+/g, ' ').trim(),\n });\n }\n } else if (\n isAttributeNode(node) &&\n (attributesToExtract as readonly string[]).includes(node.name)\n ) {\n if (node.value && node.value.length === 1 && isTextNode(node.value[0])) {\n const text = node.value[0].data ?? node.value[0].content ?? '';\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n const ref = isDestructured ? key : `$${varName}.${key}`;\n replacements.push({\n start: node.start,\n end: node.end,\n replacement: `${node.name}={${ref}}`,\n key,\n value: text.trim(),\n });\n }\n }\n }\n\n const children =\n node.children ?? node.fragment?.nodes ?? node.fragment?.children;\n\n // Try to handle mixed text + expression children as an insertion\n if (children?.some(isExpressionTagNode)) {\n const parts: {\n type: 'text' | 'var';\n value: string;\n originalExpr: string;\n }[] = [];\n let hasSignificantText = false;\n let isValid = true;\n\n for (const child of children) {\n if (isTextNode(child)) {\n const text = child.data ?? child.content ?? '';\n if (text.trim().length > 0) hasSignificantText = true;\n parts.push({ type: 'text', value: text, originalExpr: '' });\n } else if (isExpressionTagNode(child)) {\n // Source slice: skip the leading `{` and trailing `}`\n const exprCode = code.slice(child.start + 1, child.end - 1).trim();\n const varName = exprCode.includes('.')\n ? exprCode\n .split('.')\n .pop()!\n .replace(/[^\\w$]/g, '')\n : exprCode;\n parts.push({ type: 'var', value: varName, originalExpr: exprCode });\n } else {\n isValid = false;\n break;\n }\n }\n\n if (\n isValid &&\n hasSignificantText &&\n parts.some((p) => p.type === 'var')\n ) {\n let combined = '';\n for (const p of parts) {\n combined += p.type === 'var' ? `{{${p.value}}}` : p.value;\n }\n const cleanString = combined.replace(/\\s+/g, ' ').trim();\n\n if (shouldExtract?.(cleanString) && generateKey) {\n const key = generateKey(cleanString, existingKeys);\n existingKeys.add(key);\n const ref = isDestructured ? key : `$${varName}.${key}`;\n\n const uniqueVarPairs = [\n ...new Set(\n parts\n .filter((p) => p.type === 'var')\n .map((p) => `${p.value}: ${p.originalExpr}`)\n ),\n ];\n const varArgs = uniqueVarPairs.join(', ');\n const replacement = `{${ref}({ ${varArgs} })}`;\n\n const firstChild = children[0];\n const lastChild = children[children.length - 1];\n replacements.push({\n start: firstChild.start,\n end: lastChild.end,\n replacement,\n key,\n value: cleanString,\n });\n\n // Don't recurse into these children\n if (node.attributes) node.attributes.forEach(walkSvelte);\n return;\n }\n }\n }\n\n if (children) children.forEach(walkSvelte);\n if (node.attributes) node.attributes.forEach(walkSvelte);\n };\n\n if (ast.html) {\n walkSvelte(ast.html);\n }\n\n if (scriptMatch) {\n const openTagEndIndex = scriptMatch[0].indexOf('>') + 1;\n const offset = scriptMatch.index + openTagEndIndex;\n\n try {\n const babelAst = babelParse(scriptContent, {\n parserOpts: {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n },\n });\n\n if (babelAst) {\n traverse(babelAst, {\n StringLiteral(path: any) {\n if (path.parentPath.isImportDeclaration()) return;\n if (path.parentPath.isExportDeclaration()) return;\n if (path.parentPath.isImportSpecifier()) return;\n if (path.parentPath.isObjectProperty() && path.key === 'key')\n return;\n\n if (path.parentPath.isCallExpression()) {\n const callee = path.parentPath.node.callee;\n if (\n t.isMemberExpression(callee) &&\n t.isIdentifier(callee.object) &&\n callee.object.name === 'console'\n )\n return;\n\n if (\n t.isIdentifier(callee) &&\n (callee.name === 'useIntlayer' || callee.name === 't')\n )\n return;\n\n if (callee.type === 'Import') return;\n if (t.isIdentifier(callee) && callee.name === 'require') return;\n }\n\n const text = path.node.value;\n if (shouldExtract?.(text) && generateKey) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n hasScriptExtraction = true;\n\n if (path.node.start != null && path.node.end != null) {\n // Destructured: each property is a plain value → access directly.\n // Otherwise use `get(content).key` to read the Svelte store.\n const ref = isDestructured ? key : `get(${varName}).${key}`;\n replacements.push({\n start: offset + path.node.start,\n end: offset + path.node.end,\n replacement: ref,\n key,\n value: text.trim(),\n });\n }\n }\n },\n });\n }\n } catch (error) {\n console.warn(\n `Svelte extraction: Failed to parse script content for ${filename}`,\n error\n );\n }\n }\n\n // Abort if nothing was extracted\n if (replacements.length === 0) return null;\n\n // Apply Replacements in Reverse Order (prevents magic-string chunk errors)\n replacements.sort((a, b) => b.start - a.start);\n for (const { start, end, replacement, key, value } of replacements) {\n magic.overwrite(start, end, replacement);\n extractedContent[key] = value;\n }\n\n // When the existing call is destructured, inject only the missing keys into\n // the ObjectPattern — no new `content` variable is needed.\n if (\n existingCallInfo?.isDestructured &&\n existingCallInfo.closingBraceAbsolutePos >= 0\n ) {\n const missingKeys = Object.keys(extractedContent).filter(\n (k) => !existingCallInfo.existingDestructuredKeys.includes(k)\n );\n\n if (missingKeys.length > 0) {\n // Insert right after the last property so the space/newline before `}`\n // is naturally preserved: `{ a }` → `{ a, b }`.\n magic.appendLeft(\n existingCallInfo.lastPropAbsoluteEnd,\n `, ${missingKeys.join(', ')}`\n );\n }\n }\n\n // Inject necessary imports and setup\n const hasUseIntlayerImport =\n /import\\s*{[^}]*useIntlayer[^}]*}\\s*from\\s*['\"][^'\"]+['\"]/.test(\n scriptContent\n ) || /import\\s+useIntlayer\\s+from\\s*['\"][^'\"]+['\"]/.test(scriptContent);\n\n const hasGetImport =\n /import\\s*{[^}]*get[^}]*}\\s*from\\s*['\"]svelte\\/store['\"]/.test(\n scriptContent\n );\n\n // An existing call (destructured or not) means no new declaration is needed.\n const hasContentDeclaration =\n existingCallInfo !== null ||\n /const\\s+content\\s*=\\s*useIntlayer\\s*\\(/.test(scriptContent);\n\n const importStmt = hasUseIntlayerImport\n ? ''\n : `import { useIntlayer } from '${packageName}';`;\n const getImportStmt =\n hasScriptExtraction && !isDestructured && !hasGetImport\n ? `import { get } from 'svelte/store';`\n : '';\n const contentDecl = hasContentDeclaration\n ? ''\n : `const content = useIntlayer('${dictionaryKey}');`;\n\n const injectionParts = [importStmt, getImportStmt, contentDecl].filter(\n Boolean\n );\n\n if (injectionParts.length > 0) {\n const injection = `\\n ${injectionParts.join('\\n ')}\\n`;\n\n if (scriptMatch) {\n const scriptContentStart =\n scriptMatch.index + scriptMatch[0].indexOf('>') + 1;\n magic.appendLeft(scriptContentStart, injection);\n } else {\n magic.prepend(\n `<script>\\n ${importStmt}\\n ${hasScriptExtraction ? \"import { get } from 'svelte/store';\" : ''}\\n ${contentDecl}\\n</script>\\n\\n`\n );\n }\n }\n\n if (onExtract) {\n onExtract({\n dictionaryKey,\n filePath: filename,\n content: extractedContent,\n locale: defaultLocale,\n });\n }\n\n return {\n code: magic.toString(),\n map: magic.generateMap({ source: filename, includeContent: true }),\n extracted: true,\n };\n};\n\ntype Tools = {\n generateKey: (text: string, existingKeys: Set<string>) => string;\n shouldExtract: (text: string) => boolean;\n extractDictionaryKeyFromPath: (path: string) => string;\n attributesToExtract: readonly string[];\n extractTsContent: any;\n};\n\nexport const processSvelteFile = (\n filePath: string,\n _componentKey: string,\n packageName: string,\n tools: Tools,\n save: boolean = true\n): {\n extractedContent: Record<string, string>;\n code: string;\n map?: any;\n} | null => {\n const code = readFileSync(filePath, 'utf-8');\n let extractedContent: Record<string, string> | null = null;\n\n const result = intlayerSvelteExtract(code, filePath, {\n packageName,\n dictionaryKey: _componentKey,\n shouldExtract: tools.shouldExtract,\n generateKey: tools.generateKey,\n extractDictionaryKeyFromPath: tools.extractDictionaryKeyFromPath,\n attributesToExtract: tools.attributesToExtract,\n onExtract: (extractResult) => {\n extractedContent = extractResult.content;\n },\n });\n\n if (!result) return null;\n\n if (save) {\n writeFileSync(filePath, result.code);\n }\n\n return {\n extractedContent: extractedContent!,\n code: result.code,\n map: result.map,\n };\n};\n"],"mappings":"wRAsBA,MAAM,GACJ,EACA,IACqB,CACrB,IAAI,EAAyB,KAE7B,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,OAAiB,EAAY,CACjC,WAAY,CAAE,WAAY,SAAU,QAAS,CAAC,aAAc,MAAM,CAAE,CACrE,CAAC,CAEF,GAAI,CAAC,EAAK,OAAO,MAEjB,EAAA,EAAA,UAAS,EAAK,CACZ,eAAe,EAAW,CACxB,IAAM,EAAS,EAAK,KAAK,OAEzB,GACE,CAACA,EAAAA,MAAE,aAAa,EAAO,EACtB,EAAO,OAAS,eAAiB,EAAO,OAAS,cAElD,OAEF,IAAM,EAAS,EAAK,OAEpB,GAAIA,EAAAA,MAAE,qBAAqB,EAAO,EAAIA,EAAAA,MAAE,gBAAgB,EAAO,GAAG,CAAE,CAClE,IAAM,EAAa,EAAO,GAAG,WACvB,EAA2B,EAC9B,OACE,GACCA,EAAAA,MAAE,iBAAiB,EAAE,EAAIA,EAAAA,MAAE,aAAa,EAAE,IAAI,CACjD,CACA,IAAK,GAAY,EAAE,IAAY,KAAe,CAC3C,EAAW,EAAW,EAAW,OAAS,GAEhD,EAAO,CACL,eAAgB,GAChB,aAAc,UACd,2BACA,wBAAyB,GAAkB,EAAO,GAAG,IAAO,GAC5D,oBAAqB,EAAiB,EAAS,IAChD,MAOD,EAAO,CACL,eAAgB,GAChB,aANAA,EAAAA,MAAE,qBAAqB,EAAO,EAAIA,EAAAA,MAAE,aAAa,EAAO,GAAG,CACvD,EAAO,GAAG,KACV,UAKJ,yBAA0B,EAAE,CAC5B,wBAAyB,GACzB,oBAAqB,GACtB,CAGH,EAAK,MAAM,EAEd,CAAC,MACI,EAIR,OAAO,GAkCI,GACX,EACA,IACY,CACZ,GAAI,CAAC,EAAU,MAAO,GAC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