Skip to content

Commit

Permalink
update wording
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed Feb 13, 2024
1 parent c17b083 commit d9f622e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare global {
__PIXI_RENDERER__: import('pixi.js').Renderer | undefined;
__PIXI__: import('pixi.js');
__PIXI_DEVTOOLS_WRAPPER__: any;
__PIXI__DEVTOOLS__: {
__PIXI_DEVTOOLS__: {
pixi: typeof import('pixi.js');
app: import('pixi.js').Application | undefined;
stage?: import('pixi.js').Container | undefined;
Expand Down
16 changes: 8 additions & 8 deletions src/chrome/src/inject/devtool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ export function getPixiWrapper(): Pixi {
if (!pixiWrapper) {
pixiWrapper = {
app: () => {
if (window.__PIXI__DEVTOOLS__?.app) {
return window.__PIXI__DEVTOOLS__.app;
if (window.__PIXI_DEVTOOLS__?.app) {
return window.__PIXI_DEVTOOLS__.app;
}
return window.__PIXI_APP__;
},
stage: () => {
if (window.__PIXI__DEVTOOLS__?.stage) {
return window.__PIXI__DEVTOOLS__.stage;
if (window.__PIXI_DEVTOOLS__?.stage) {
return window.__PIXI_DEVTOOLS__.stage;
} else if (window.__PIXI_STAGE__) {
return window.__PIXI_STAGE__;
}

return pixiWrapper!.app()?.stage;
},
renderer: () => {
if (window.__PIXI__DEVTOOLS__?.renderer) {
return window.__PIXI__DEVTOOLS__.renderer;
if (window.__PIXI_DEVTOOLS__?.renderer) {
return window.__PIXI_DEVTOOLS__.renderer;
} else if (window.__PIXI_RENDERER__) {
return window.__PIXI_RENDERER__;
}
Expand All @@ -59,8 +59,8 @@ export function getPixiWrapper(): Pixi {
return getPixiState();
},
pixi: () => {
if (window.__PIXI__DEVTOOLS__?.pixi) {
return window.__PIXI__DEVTOOLS__.pixi;
if (window.__PIXI_DEVTOOLS__?.pixi) {
return window.__PIXI_DEVTOOLS__.pixi;
}
return window.__PIXI__;
},
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/src/inject/properties/PropertyPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class PropertyPluginsClass {
}

private _getUserPlugins() {
return window.__PIXI__DEVTOOLS__?.scenePanel?.propertyPlugins || [];
return window.__PIXI_DEVTOOLS__?.scenePanel?.propertyPlugins || [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Application, Assets, Container, Sprite } from 'pixi.js';
// Initialize the application
await app.init({ background: '#1099bb', resizeTo: window });

window.__PIXI__DEVTOOLS__ = {
window.__PIXI_DEVTOOLS__ = {
app: app,
pixi: PIXI,
};
Expand Down
15 changes: 15 additions & 0 deletions vite.chrome.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { crx, ManifestV3Export } from '@crxjs/vite-plugin';
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
import fs from 'fs';
import path from 'path';

import { resolve } from 'path';
import pkg from './package.json';
Expand Down Expand Up @@ -34,6 +36,19 @@ export default defineConfig((config) => {
injectCss: true,
},
}),
{
name: 'manifest-plugin',
enforce: "post",
writeBundle() {
const manifestPath = path.resolve(__dirname, 'dist/chrome', 'manifest.json');
if (fs.existsSync(manifestPath)) {
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
const resource = manifest.web_accessible_resources[0];
resource.resources.push('src/inject/index.js');
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
}
},
},
],
publicDir,
build: {
Expand Down

0 comments on commit d9f622e

Please sign in to comment.