Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2916227
index.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
638 B
Referenced Files
None
Subscribers
None
index.ts
View Options
import
{
nanoid
}
from
'nanoid'
;
import
{
join
}
from
'node:path'
;
import
{
rolldown
}
from
'rolldown'
;
const
args
=
[
`id=
${
nanoid
()
}
`
];
const
replacements
:
Record
<
string
,
string
>
=
{};
for
(
const
arg
of
args
)
{
const
pivot
=
arg
.
indexOf
(
'='
);
if
(
pivot
===
-
1
)
continue
;
const
key
=
arg
.
slice
(
0
,
pivot
);
const
value
=
arg
.
slice
(
pivot
+
1
);
replacements
[
`import.meta.env.
${
key
}
`
]
=
JSON
.
stringify
(
value
);
}
const
bundle
=
await
rolldown
({
input
:
join
(
import
.
meta
.
dirname
,
'app.jsx'
),
transform
:
{
define
:
replacements
}
});
const
{
output
}
=
await
bundle
.
generate
({});
if
(
output
.
length
)
console
.
log
(
output
[
0
].
code
);
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Thu, Mar 26, 4:44 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
511912
Default Alt Text
index.ts (638 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment