@lapikit/repl 0.0.0-insiders.e242cea → 0.0.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/Repl.svelte +1 -5
- package/dist/Repl.svelte.d.ts +1 -1
- package/dist/index.d.ts +1 -9
- package/dist/index.js +2 -71
- package/package.json +79 -82
- package/dist/components.d.ts +0 -1
- package/dist/components.js +0 -2
package/dist/Repl.svelte
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
lang?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
let { title, content, children
|
|
20
|
+
let { title, content, children } = $props();
|
|
21
21
|
let codeHTML = $state('');
|
|
22
22
|
let copyState = $state(false);
|
|
23
23
|
let viewMode = $state('editor');
|
|
@@ -61,10 +61,6 @@
|
|
|
61
61
|
let activeFile = $derived(files[activeFileIndex]);
|
|
62
62
|
let hasMultipleFiles = $derived(files.length > 1);
|
|
63
63
|
|
|
64
|
-
$effect(() => {
|
|
65
|
-
console.log('Props rest', rest);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
64
|
let iconMap = {
|
|
69
65
|
code: CodeIcon,
|
|
70
66
|
javascript: JavaScriptIcon,
|
package/dist/Repl.svelte.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,71 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return 'Kit' + shortName.charAt(0).toUpperCase() + shortName.slice(1);
|
|
4
|
-
}
|
|
5
|
-
function replPreprocess() {
|
|
6
|
-
return {
|
|
7
|
-
markup({ content }) {
|
|
8
|
-
const hasComponent = components.some((comp) => content.includes(`<repl:${comp}`));
|
|
9
|
-
if (!hasComponent)
|
|
10
|
-
return;
|
|
11
|
-
let processedContent = content;
|
|
12
|
-
const importedComponents = new Set();
|
|
13
|
-
let hasChanges = true;
|
|
14
|
-
while (hasChanges) {
|
|
15
|
-
hasChanges = false;
|
|
16
|
-
for (const shortName of components) {
|
|
17
|
-
const componentNameStr = componentName(shortName);
|
|
18
|
-
const attrPattern = `(?:[^>"']|"[^"]*"|'[^']*')*?`;
|
|
19
|
-
const selfClosingRegex = new RegExp(`<repl:${shortName}(${attrPattern})\\s*/>`, 'g');
|
|
20
|
-
const pairRegex = new RegExp(`<repl:${shortName}(${attrPattern})>([\\s\\S]*?)<\\/repl:${shortName}\\s*>`, 'g');
|
|
21
|
-
let newContent = processedContent.replace(selfClosingRegex, (fullMatch, attrs) => {
|
|
22
|
-
hasChanges = true;
|
|
23
|
-
importedComponents.add(componentNameStr);
|
|
24
|
-
return `<${componentNameStr}${attrs} />`;
|
|
25
|
-
});
|
|
26
|
-
newContent = newContent.replace(pairRegex, (fullMatch, attrs, children) => {
|
|
27
|
-
hasChanges = true;
|
|
28
|
-
importedComponents.add(componentNameStr);
|
|
29
|
-
return `<${componentNameStr}${attrs}>${children}</${componentNameStr}>`;
|
|
30
|
-
});
|
|
31
|
-
if (newContent !== processedContent) {
|
|
32
|
-
processedContent = newContent;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (processedContent === content)
|
|
37
|
-
return;
|
|
38
|
-
if (importedComponents.size > 0) {
|
|
39
|
-
const imports = Array.from(importedComponents).join(', ');
|
|
40
|
-
const scriptRegex = /<script(?![^>]*\bmodule\b)([^>]*)>/;
|
|
41
|
-
const scriptMatch = processedContent.match(scriptRegex);
|
|
42
|
-
if (scriptMatch && scriptMatch.index !== undefined) {
|
|
43
|
-
const insertPos = scriptMatch.index + scriptMatch[0].length;
|
|
44
|
-
processedContent =
|
|
45
|
-
processedContent.slice(0, insertPos) +
|
|
46
|
-
`\n\timport { ${imports} } from '@lapikit/repl/components';` +
|
|
47
|
-
processedContent.slice(insertPos);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const moduleScriptMatch = processedContent.match(/<script[^>]*\bmodule\b[^>]*>/);
|
|
51
|
-
if (moduleScriptMatch && moduleScriptMatch.index !== undefined) {
|
|
52
|
-
const moduleScriptEnd = processedContent.indexOf('</script>', moduleScriptMatch.index) + '</script>'.length;
|
|
53
|
-
processedContent =
|
|
54
|
-
processedContent.slice(0, moduleScriptEnd) +
|
|
55
|
-
`\n\n<script>\n\timport { ${imports} } from '@lapikit/repl/components';\n</script>` +
|
|
56
|
-
processedContent.slice(moduleScriptEnd);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
processedContent =
|
|
60
|
-
`<script>\n\timport { ${imports} } from '@lapikit/repl/components';\n</script>\n\n` +
|
|
61
|
-
processedContent;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
code: processedContent
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export { replPreprocess };
|
|
1
|
+
// components
|
|
2
|
+
export { default as KitCode } from './Repl.svelte';
|
package/package.json
CHANGED
|
@@ -1,84 +1,81 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"@lucide/svelte": "^0.562.0",
|
|
82
|
-
"shiki": "^3.20.0"
|
|
83
|
-
}
|
|
2
|
+
"name": "@lapikit/repl",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Nycolaide",
|
|
10
|
+
"email": "contact@lapikit.dev"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/Nycolaide/lapikit.git"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "vite dev",
|
|
18
|
+
"build": "vite build && npm run prepack",
|
|
19
|
+
"preview": "vite preview",
|
|
20
|
+
"prepare": "svelte-kit sync || echo ''",
|
|
21
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
22
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
23
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
24
|
+
"format": "prettier --write .",
|
|
25
|
+
"lint": "prettier --check . && eslint .",
|
|
26
|
+
"test:unit": "vitest",
|
|
27
|
+
"test": "npm run test:unit -- --run"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"!dist/**/*.test.*",
|
|
32
|
+
"!dist/**/*.spec.*"
|
|
33
|
+
],
|
|
34
|
+
"sideEffects": [
|
|
35
|
+
"**/*.css"
|
|
36
|
+
],
|
|
37
|
+
"svelte": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"type": "module",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"svelte": "./dist/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@sveltejs/kit": "^2.0.0",
|
|
48
|
+
"svelte": "^5.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/compat": "^1.4.0",
|
|
52
|
+
"@eslint/js": "^9.39.1",
|
|
53
|
+
"@sveltejs/adapter-auto": "^7.0.0",
|
|
54
|
+
"@sveltejs/kit": "^2.49.1",
|
|
55
|
+
"@sveltejs/package": "^2.5.7",
|
|
56
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
57
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
58
|
+
"@testing-library/svelte": "^5.2.4",
|
|
59
|
+
"eslint": "^9.39.1",
|
|
60
|
+
"eslint-config-prettier": "^10.1.8",
|
|
61
|
+
"eslint-plugin-svelte": "^3.13.1",
|
|
62
|
+
"globals": "^16.5.0",
|
|
63
|
+
"jsdom": "^26.0.0",
|
|
64
|
+
"prettier": "^3.7.4",
|
|
65
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
66
|
+
"publint": "^0.3.15",
|
|
67
|
+
"svelte": "^5.45.6",
|
|
68
|
+
"svelte-check": "^4.3.4",
|
|
69
|
+
"typescript": "^5.9.3",
|
|
70
|
+
"typescript-eslint": "^8.48.1",
|
|
71
|
+
"vite": "^7.2.6",
|
|
72
|
+
"vitest": "^4.0.15"
|
|
73
|
+
},
|
|
74
|
+
"keywords": [
|
|
75
|
+
"svelte"
|
|
76
|
+
],
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@lucide/svelte": "^0.562.0",
|
|
79
|
+
"shiki": "^3.20.0"
|
|
80
|
+
}
|
|
84
81
|
}
|
package/dist/components.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as KitCode } from './Repl.svelte';
|
package/dist/components.js
DELETED