Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Examples Browser NPM dependencies #7113

Merged
merged 9 commits into from
Nov 14, 2024
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: 0 additions & 2 deletions examples/assets/scripts/misc/camera-frame.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable jsdoc/check-tag-names */

import {
Script,
Color,
Expand Down
30 changes: 30 additions & 0 deletions examples/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import playcanvasConfig from '@playcanvas/eslint-config';
import globals from 'globals';

export default [
...playcanvasConfig,
{
files: ['**/*.js', '**/*.mjs'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
'ObjModelParser': 'readonly',
'OutlineEffect': 'readonly'
}
},
rules: {
'import/no-unresolved': 'off'
}
},
{
ignores: [
'assets/scripts/utils/area-light-lut-bin-gen.js',
'cache',
'dist',
'src/lib',
'src/app/monaco/languages',
'src/app/monaco/tokenizer-rules.mjs'
]
}
];
6 changes: 3 additions & 3 deletions examples/iframe/loader.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { updateDeviceType, fetchFile, localImport, clearImports, parseConfig, fire } from 'examples/utils';
import { data, refresh } from 'examples/observer';
import files from 'examples/files';
import { data, refresh } from 'examples/observer';
import { updateDeviceType, fetchFile, localImport, clearImports, parseConfig, fire } from 'examples/utils';

import MiniStats from './ministats.mjs';

Expand Down Expand Up @@ -82,7 +82,7 @@ class ExampleLoader {
*/
const locations = [];
lines.forEach((line) => {
const match = /^\s*at\s(.+):(\d+):(\d+)$/g.exec(line);
const match = /^\s*at\s(.+):(\d+):(\d+)$/.exec(line);
if (!match) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions examples/iframe/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const rootPath = root.replace(/\/iframe/g, '');
*/
export function getQueryParams(url) {
return Object.fromEntries(url
.split('?').pop()
.split('#')[0]
.split('&').map(s => s.split('=')));
.split('?').pop()
.split('#')[0]
.split('&').map(s => s.split('=')));
}

/**
Expand Down Expand Up @@ -90,14 +90,14 @@ export function clearImports() {
* @returns {Record<string, any>} - The parsed config.
*/
export function parseConfig(script) {
const regex = /\/\/ @config ([^ \n]+) ?([^\n]+)?/g;
const regex = /\/\/ @config (\S+)(?:\s+([^\n]+))?/g;
let match;
/** @type {Record<string, any>} */
const config = {};
while ((match = regex.exec(script)) !== null) {
const key = match[1].trim();
const val = match[2]?.trim();
config[key] = /true|false/g.test(val) ? val === 'true' : val ?? true;
config[key] = /true|false/.test(val) ? val === 'true' : val ?? true;
}
return config;
}
Expand All @@ -113,7 +113,7 @@ export function updateDeviceType(config) {
deviceType = DEVICE_TYPES.includes(savedDevice) ? savedDevice : 'webgl2';

if (params.deviceType && DEVICE_TYPES.includes(params.deviceType)) {
console.warn("Overriding default device: ", params.deviceType);
console.warn('Overriding default device: ', params.deviceType);
deviceType = params.deviceType;
return;
}
Expand Down
Loading