Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/.vitepress/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const enUs = defineConfig({
{ text: 'Get Started', link: '/get-started/installation' },
{
text: 'API Reference',
link: '/api-reference/method-functions/run-method',
link: '/api-reference/configuration-reference/typescript-configuration',
},
{ text: 'Concepts', link: '/concepts/what-is' },
navAbout,
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const idId = defineConfig({
{ text: 'Memulai', link: '/id/get-started/installation' },
{
text: 'Referensi API',
link: '/id/api-reference/method-functions/run-method',
link: '/id/api-reference/configuration-reference/typescript-configuration',
},
{ text: 'Konsep', link: '/id/concepts/what-is' },
navAbout,
Expand Down
7 changes: 4 additions & 3 deletions docs/.vitepress/lang/en/sidebarAPIReferences.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { sidebarConfigurationReference } from './sidebarConfigurationReference.js';
import { sidebarDataTypes } from './sidebarDataTypes.js';
import { sidebarMethodFunctions } from './sidebarMethodFunctions.js';
import { sidebarInstructionSet } from './sidebarInstructionSet.js';
import { sidebarErrorCodes } from './sidebarErrorCodes.js';

export const sidebarAPIReferences = [
sidebarConfigurationReference,
sidebarDataTypes,
sidebarMethodFunctions,
{ text: 'Primitive Types', link: '/api-reference/primitive-types' },
{ text: 'Capabilities', link: '/api-reference/capabilities' },
{ text: 'Time Budget', link: '/api-reference/time-budget' },
sidebarInstructionSet,
sidebarErrorCodes,
];
14 changes: 14 additions & 0 deletions docs/.vitepress/lang/en/sidebarConfigurationReference.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const sidebarConfigurationReference = {
text: 'Configuration Reference',
collapsed: false,
items: [
{
text: 'TypeScript Configuration',
link: '/api-reference/configuration-reference/typescript-configuration',
},
{
text: 'Rust Configuration',
link: '/api-reference/configuration-reference/rust-configuration',
}
],
};
9 changes: 9 additions & 0 deletions docs/.vitepress/lang/en/sidebarDataTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const sidebarDataTypes = {
text: 'Data Types',
collapsed: false,
items: [
{ text: 'Primitive Types', link: '/api-reference/data-types/primitive-types' },
{ text: 'Capabilities', link: '/api-reference/data-types/capabilities' },
{ text: 'Time Budget', link: '/api-reference/data-types/time-budget' },
],
};
2 changes: 1 addition & 1 deletion docs/.vitepress/lang/en/sidebarGetStarted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const sidebarGetStarted = [
},
{
text: 'API References',
link: '/api-reference/method-functions/run-method',
link: '/api-reference/configuration-reference/typescript-configuration',
},
{
text: 'Concepts',
Expand Down
7 changes: 4 additions & 3 deletions docs/.vitepress/lang/id/sidebarAPIReferences.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { sidebarConfigurationReference } from './sidebarConfigurationReference.js';
import { sidebarDataTypes } from './sidebarDataTypes.js';
import { sidebarMethodFunctions } from './sidebarMethodFunctions.js';
import { sidebarInstructionSet } from './sidebarInstructionSet.js';
import { sidebarErrorCodes } from './sidebarErrorCodes.js';

export const sidebarAPIReferences = [
sidebarConfigurationReference,
sidebarDataTypes,
sidebarMethodFunctions,
{ text: 'Tipe Primitif', link: '/id/api-reference/primitive-types' },
{ text: 'Kapabilitas', link: '/id/api-reference/capabilities' },
{ text: 'Batas Waktu Eksekusi', link: '/id/api-reference/time-budget' },
sidebarInstructionSet,
sidebarErrorCodes,
];
14 changes: 14 additions & 0 deletions docs/.vitepress/lang/id/sidebarConfigurationReference.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const sidebarConfigurationReference = {
text: 'Referensi Konfigurasi',
collapsed: false,
items: [
{
text: 'Konfigurasi TypeScript',
link: '/id/api-reference/configuration-reference/typescript-configuration',
},
{
text: 'Konfigurasi Rust',
link: '/id/api-reference/configuration-reference/rust-configuration',
},
],
};
9 changes: 9 additions & 0 deletions docs/.vitepress/lang/id/sidebarDataTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const sidebarDataTypes = {
text: 'Tipe Data',
collapsed: false,
items: [
{ text: 'Tipe Primitif', link: '/id/api-reference/data-types/primitive-types' },
{ text: 'Kapabilitas', link: '/id/api-reference/data-types/capabilities' },
{ text: 'Batas Waktu Eksekusi', link: '/id/api-reference/data-types/time-budget' },
],
};
2 changes: 1 addition & 1 deletion docs/.vitepress/lang/id/sidebarGetStarted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const sidebarGetStarted = [
},
{
text: 'Referensi API',
link: '/id/api-reference/method-functions/run-method',
link: '/id/api-reference/configuration-reference/typescript-configuration',
},
{
text: 'Konsep',
Expand Down
84 changes: 83 additions & 1 deletion docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,86 @@ div[class*="language-"] > pre {
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
}
@keyframes floatAndGlow {
0%, 100% {
transform: translateY(0);
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}
50% {
transform: translateY(-6px);
filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.12));
}
}

/* Light mode (default) */
.VPImage {
animation: floatAndGlow 4s ease-in-out infinite;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

/* Dark mode */
.dark .VPImage {
filter: invert(1) hue-rotate(180deg);
/* Di dark mode, shadow-nya dibikin sedikit lebih terang/glow tipis biar kontras */
animation: floatAndGlowDark 4s ease-in-out infinite;
}

@keyframes floatAndGlowDark {
0%, 100% {
transform: translateY(0);
filter: invert(1) hue-rotate(180deg) drop-shadow(0 4px 6px rgba(255, 255, 255, 0.05));
}
50% {
transform: translateY(-6px);
filter: invert(1) hue-rotate(180deg) drop-shadow(0 12px 16px rgba(255, 255, 255, 0.15));
}
}

/* Keyframes buat animasi muncul dari bawah ke atas dengan halus */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

/* Terapkan ke elemen teks utama di beranda VitePress (Hero section) */
.VPHero .name {
animation: fadeInUp 0.8s ease-out forwards;
}

.VPHero .text {
animation: fadeInUp 0.8s ease-out 0.2s forwards;
opacity: 0; /* Mencegah kedip sebelum animasi mulai */
}

.VPHero .tagline {
animation: fadeInUp 0.8s ease-out 0.4s forwards;
opacity: 0;
}

.VPHero .actions {
animation: fadeInUp 0.8s ease-out 0.6s forwards;
opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
.VPImage,
.dark .VPImage,
.VPHero .name,
.VPHero .text,
.VPHero .tagline,
.VPHero .actions {
animation: none;
}

.VPHero .text,
.VPHero .tagline,
.VPHero .actions {
opacity: 1;
}
}
6 changes: 3 additions & 3 deletions docs/data/stats.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"weekly": "3.5",
"allTime": "42.8",
"updatedAt": "2026-07-28T12:35:48.172Z"
"weekly": "4.0",
"allTime": "96.3",
"updatedAt": "2026-09-21T00:42:01.698Z"
}
26 changes: 0 additions & 26 deletions docs/en/api-reference/capabilities.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Rust Configuration
This page provides a comprehensive reference for all available configuration options, limits, and security controls when initializing a `LightVM` instance.

## Full Configuration Example
The following example demonstrates how to configure all available limits, safety flags, and error options using both the builder and object patterns.

::: code-group
<<< @/examples/configuration-reference/builder_pattern.rs{rs:line-numbers}[Builder Pattern]
<<< @/examples/configuration-reference/object_pattern.rs{rs:line-numbers}[Object Pattern]
:::

## Configuration Options Breakdown

| Method / Property | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `caps` | `Vec<Capability>` | `vec![]` (grants `Capability::Observe`) | Specifies the active capabilities granted to the virtual machine. |
| `set_max_io` / `max_io` | `usize` | `100` | Maximum number of I/O operations allowed during execution. |
| `set_max_import` / `max_import` | `usize` | `3` | Maximum number of allowed module imports. |
| `set_max_alloc` / `max_alloc` | `usize` | `50` | Maximum number of memory allocations allowed. |
| `set_max_call` / `max_call` | `usize` | `200` | Maximum number of nested function calls allowed. |
| `set_max_jump` / `max_jump` | `usize` | `100` | Maximum number of control flow jumps allowed. |
| `set_max_ticks` / `max_ticks` | `u64` | `1_000_000` | Maximum number of execution ticks before stopping to prevent infinite loops. |
| `set_max_stack_size` / `max_stack_size` | `usize` | `128` | Maximum number of items the evaluation stack can hold. |
| `set_allowed_imports` / `allowed_imports` | `Vec<String>` | `vec!["math".into(), "time".into(), "utils".into()]` | Whitelist of module names that are permitted to be imported. |
| `set_time_budget` / `time_budget` | `TimeBudget` | `TimeBudget::Cheap` | Sets the execution time budget tier limit. |
| `with_unsafe_mode` / `unsafe_mode` | `bool` | `false` | Enables or disables system-level unsafe operations. |
| `with_nightly` / `nightly` | `bool` | `false` | Allows the usage of experimental nightly features. |
| `with_backtrace` / `backtrace` | `bool` | `false` | Displays internal backtrace details in error messages. |
| `with_explain` / `explain` | `bool` | `false` | Displays a more detailed explanatory hint in error messages. |
| `with_hint` / `hint` | `bool` | `true` | Displays general usage hints on error messages. |
| `with_diagnostic_links` / `diagnostic_links` | `bool` | `true` | Includes metadata links pointing to error-code documentation. |

::: info Related Documentation
Need to check individual error codes mentioned in error messages? Visit the [Error Code Reference](/api-reference/error-codes/lvm001-code).
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# TypeScript Configuration
This page provides a comprehensive reference for all available configuration options, limits, and security controls when initializing a `LightVM` instance.

## Full Configuration Example
The following example demonstrates how to configure all available limits, safety flags, and error options using both the builder and object patterns.

::: code-group
<<< @/examples/configuration-reference/builderPattern.ts{ts:line-numbers}[Builder Pattern]
<<< @/examples/configuration-reference/objectPattern.ts{ts:line-numbers}[Object Pattern]
:::

## Configuration Options Breakdown

| Method / Property | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `caps` | `Capability[]` | `[Capability.Observe]` | Specifies the active capabilities granted to the virtual machine. |
| `setMaxIo` / `maxIo` | `number` | `100` | Maximum number of I/O operations allowed during execution. |
| `setMaxImport` / `maxImport` | `number` | `3` | Maximum number of allowed module imports. |
| `setMaxAlloc` / `maxAlloc` | `number` | `50` | Maximum number of memory allocations allowed. |
| `setMaxCall` / `maxCall` | `number` | `200` | Maximum number of nested function calls allowed. |
| `setMaxJump` / `maxJump` | `number` | `100` | Maximum number of control flow jumps allowed. |
| `setMaxTicks` / `maxTicks` | `number` | `1_000_000` | Maximum number of execution ticks before stopping to prevent infinite loops. |
| `setMaxStackSize` / `maxStackSize` | `number` | `128` | Maximum number of items the evaluation stack can hold. |
| `setAllowedImports` / `allowedImports` | `string[]` | `[]` | Whitelist of module names that are permitted to be imported. |
| `setTimeBudget` / `timeBudget` | `TimeBudget` | `TimeBudget.Cheap` | Sets the execution time budget tier limit. |
| `withUnsafeMode` / `unsafeMode` | `boolean` | `false` | Enables or disables system-level unsafe operations. |
| `withNightly` / `nightly` | `boolean` | `false` | Allows the usage of experimental nightly features. |
| `withBacktrace` / `backtrace` | `boolean` | `false` | Displays internal backtrace details in error messages. |
| `withExplain` / `explain` | `boolean` | `false` | Displays a more detailed explanatory hint in error messages. |
| `withHint` / `hint` | `boolean` | `true` | Displays general usage hints on error messages. |
| `withDiagnosticLinks` / `diagnosticLinks` | `boolean` | `true` | Includes metadata links pointing to error-code documentation. |

::: info Related Documentation
Need to check individual error codes mentioned in error messages? Visit the [Error Code Reference](/api-reference/error-codes/lvm001-code).
:::
16 changes: 16 additions & 0 deletions docs/en/api-reference/data-types/capabilities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Capabilities

A `Capability` grants a host operation permission to access a protected `LightVM` function. Pass the required values in `VMConfig.caps`. TypeScript uses `Observe` by default.

| Capability | Numeric value | Protected operations |
| --- | ---: | --- |
| `Control` | `0` | `run`, `compile`, `embedded`, function exports, `provide`, clearing outputs, and bytecode optimization |
| `Observe` | `1` | `inspect`, reading outputs, and variable exports |
| `Debug` | `2` | Benchmarks, reading panic records, and clearing panic records |
| `Unsafe` | `3` | `halt`, which stops the VM |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

`unsafeMode` (or `unsafe_mode` in **Rust**) in disables security checks such as import restrictions and resource quotas for I/O, imports, allocations, calls, and jumps, but does not grant capability permissions. Bounds verification remains enabled. Calling `halt` still requires the `Unsafe` capability in `VMConfig.caps`, even with this mode enabled.

::: warning
Failing to provide the required capabilities will cause protected host operations to fail execution or trigger runtime errors. Always ensure you grant the minimum necessary capability permissions required by your application.
:::
9 changes: 9 additions & 0 deletions docs/en/api-reference/data-types/time-budget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Time Budget

`TimeBudget` sets how much time Gazle can spend optimizing bytecode. It does not limit VM execution time.

| Value | Numeric value | Optimizer budget |
| :--- | :--- | :--- |
| `Cheap` (default) | `0` | 200 ms |
| `Normal` | `1` | 1,000 ms |
| `Expensive` | `2` | 5,000 ms |
4 changes: 4 additions & 0 deletions docs/en/api-reference/method-functions/info-method.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ In **Rust**, you can query the initialized VM instance to inspect current runtim
<<< @/examples/methodFunctions/info_code.rs{rust:line-numbers}[Code]

:::

::: info
**Capability Required**: no specific capability
:::
17 changes: 0 additions & 17 deletions docs/en/api-reference/time-budget.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/en/get-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ If you're using **Rust**, use **Cargo** to integrate **LightVM** natively.
<<< @/examples/installation/cargo-specific.sh{sh:line-numbers}[Specific Version]

:::

## Expected result

The package is added to your project manifest and is available to import. Continue with [Quick Usage](/get-started/quick-usage) to create a `LightVM` instance.
Loading
Loading