download
raw
1.18 kB
'use strict'
const { test } = require('node:test')
const webpack = require('webpack')
const path = require('path')
test('the library should work with webpack', async (t) => {
t.plan(1)
const targetdir = path.resolve(__dirname, '..', '.cache')
const targetname = path.join(targetdir, 'webpacktest.js')
const wopts = {
entry: path.resolve(__dirname, '..', 'index.js'),
mode: 'production',
target: 'node',
output: {
path: targetdir,
filename: 'webpacktest.js',
library: {
name: 'fastJsonStringify',
type: 'umd'
}
}
}
await new Promise((resolve, reject) => {
webpack(wopts, (err, stats) => {
if (err) { reject(err) } else { resolve(stats) };
})
})
const build = require(targetname)
const stringify = build({
title: 'webpack should not rename code to be executed',
type: 'object',
properties: {
foo: {
type: 'string'
},
bar: {
type: 'boolean'
}
},
patternProperties: {
foo: {
type: 'number'
}
}
})
const obj = { foo: '42', bar: true }
t.assert.equal(stringify(obj), '{"foo":"42","bar":true}')
})

Xet Storage Details

Size:
1.18 kB
·
Xet hash:
bed6dceeec118b44aeb52814594c340693e390c0a0ca9d5feb4ea0be0a844e63

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.