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
47 changes: 7 additions & 40 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,48 +1,15 @@
import javascriptConfig from '@playcanvas/eslint-config/javascript';
import prettierConfig from 'eslint-config-prettier/flat';
import globals from 'globals';
import typescriptConfig from '@playcanvas/eslint-config/typescript';

export default [
...javascriptConfig,
...typescriptConfig,
{
ignores: ['dist/**', 'types/**', 'test/fixtures/**']
ignores: ['types/**', 'test/fixtures/**']
},
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.mocha,
...globals.node
}
}
},
{
rules: {
'no-unused-expressions': 'off',
'jsdoc/check-tag-names': 'off',
'import/no-unresolved': 'off'
}
},
{
files: ['**/*.mjs'],
languageOptions: {
globals: {
...globals.node
}
},
// chai assertions like expect(x).to.be.true are expression statements
files: ['test/**/*.test.js'],
rules: {
'import/no-named-as-default': 'off'
'@typescript-eslint/no-unused-expressions': 'off'
}
},
{
// Configuration specific to test files
files: ['**/*.test.js'], // Match test files

rules: {
'prefer-arrow-callback': 'off' // Allow function expressions in test files
}
},
prettierConfig
}
];
29 changes: 23 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 32 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{
"name": "@playcanvas/attribute-parser",
"version": "1.10.3",
"author": "PlayCanvas <support@playcanvas.com>",
"homepage": "https://github.com/playcanvas/attribute-parser#readme",
"description": "The PlayCanvas Attribute Parser",
"keywords": [
"playcanvas",
"attribute",
"parser"
],
"homepage": "https://github.com/playcanvas/attribute-parser#readme",
"bugs": {
"url": "https://github.com/playcanvas/attribute-parser/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/playcanvas/attribute-parser.git"
},
"license": "MIT",
"author": "PlayCanvas <support@playcanvas.com>",
"type": "module",
"main": "dist/index.js",
"types": "types/index.d.ts",
"exports": {
".": {
"types": "./types/index.d.ts",
Expand All @@ -22,41 +27,13 @@
},
"./libs": "./dist/libs.d.ts"
},
"bugs": {
"url": "https://github.com/playcanvas/attribute-parser/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/playcanvas/attribute-parser.git"
},
"main": "dist/index.js",
"types": "types/index.d.ts",
"files": [
"dist/index.js",
"dist/index.node.mjs",
"dist/libs.d.ts",
"types",
"README.md",
"LICENSE.md"
"types"
],
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.9",
"@rollup/plugin-node-resolve": "16.0.3",
"@rollup/plugin-swc": "0.4.1",
"@swc/core": "1.15.43",
"chai": "5.3.3",
"eslint-config-prettier": "10.1.8",
"globals": "16.5.0",
"mocha": "11.7.6",
"playcanvas": "2.12.3",
"prettier": "3.9.4",
"publint": "0.3.21",
"rollup": "4.62.2"
},
"dependencies": {
"@playcanvas/eslint-config": "3.0.0-beta.8",
"@typescript/vfs": "^1.6.0",
"eslint": "^9.0.0",
"typescript": "^5.5.3"
},
"scripts": {
"build": "rollup -c && npm run build:types",
"build:types": "tsc -p tsconfig.build.json",
Expand All @@ -69,7 +46,26 @@
"typecheck": "tsc --noEmit",
"watch": "rollup -c -w"
},
"dependencies": {
"@playcanvas/eslint-config": "3.0.0-beta.8",
"@typescript/vfs": "^1.6.0",
"eslint": "^9.0.0",
"typescript": "^5.5.3"
},
"devDependencies": {
"@rollup/plugin-commonjs": "28.0.9",
"@rollup/plugin-node-resolve": "16.0.3",
"@rollup/plugin-swc": "0.4.1",
"@swc/core": "1.15.43",
"@types/node": "26.1.0",
"chai": "5.3.3",
"mocha": "11.7.6",
"playcanvas": "2.12.3",
"prettier": "3.9.4",
"publint": "0.3.21",
"rollup": "4.62.2"
},
"engines": {
"node": ">=18.0.0"
"node": ">=22.0.0"
}
}
24 changes: 15 additions & 9 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import ts from 'typescript';

const production = process.env.NODE_ENV === 'production';

// Concatenates the TypeScript compiler options into a single file
const types = knownLibFilesForCompilerOptions({ target: ts.ScriptTarget.ES2023 }, ts).reduce((acc, file) => {
const src = fs.readFileSync(`node_modules/typescript/lib/${file}`, 'utf8');
return `${acc}// ${file}\n${src}\n\n`;
}, '');
// Concatenates the TypeScript compiler options into a single file. The known lib list can
// include files removed in newer TypeScript versions (e.g. lib.es2022.sharedmemory.d.ts),
// so skip any that no longer exist.
const types = knownLibFilesForCompilerOptions({ target: ts.ScriptTarget.ES2023 }, ts)
.filter((file) => fs.existsSync(`node_modules/typescript/lib/${file}`))
.reduce((acc, file) => {
const src = fs.readFileSync(`node_modules/typescript/lib/${file}`, 'utf8');
return `${acc}// ${file}\n${src}\n\n`;
}, '');
fs.mkdirSync('dist', { recursive: true });
fs.writeFileSync('dist/libs.d.ts', types);

Expand All @@ -29,7 +33,7 @@ const swcPlugin = () =>
// Browser build: bundles typescript and @typescript/vfs and stubs out node built-ins,
// for in-browser consumers (e.g. the editor), which supply lib types via a CDN.
const browser = {
input: 'src/index.js',
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm'
Expand All @@ -42,7 +46,8 @@ const browser = {
}),
resolve({
browser: true, // This instructs the plugin to resolve for the browser
preferBuiltins: false // Prefer the local versions of built-ins instead of Node.js versions
preferBuiltins: false, // Prefer the local versions of built-ins instead of Node.js versions
extensions: ['.js', '.ts']
}),
swcPlugin()
]
Expand All @@ -52,7 +57,7 @@ const browser = {
// (real os/fs/path and a native require). The browser build stubs these out, which breaks
// createDefaultMapFromNodeModules and TypeScript's getNodeSystem() under node.
const node = {
input: 'src/index.js',
input: 'src/index.ts',
external: [/^node:/, 'typescript', '@typescript/vfs'],
output: {
dir: 'dist',
Expand All @@ -62,7 +67,8 @@ const node = {
plugins: [
resolve({
exportConditions: ['node'],
preferBuiltins: true
preferBuiltins: true,
extensions: ['.js', '.ts']
}),
swcPlugin()
]
Expand Down
Loading