rokucommunity / roku-debug

A compatibility wrapper around the BrightScript debug protocol https://developer.roku.com/en-ca/docs/developer-program/debugging/socket-based-debugger.md
MIT License
13 stars 9 forks source link

common:/LibCore/v30/bslCore.brs path improperly modified in component libraries #106

Closed triwav closed 1 year ago

triwav commented 1 year ago

If you include it like <script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/> in a component library it tries to convert that to something like <script type="text/brightscript" uri="common:/LibCore/v30/bslCore__lib2.brs"/> which then causes the component library to fail to load due that file not existing. Probably the best way to handle is to make sure that the path is pkg:/ before trying to modify the path for it.

TwitchBronBron commented 1 year ago

Here's a unit test that can be placed within ProjectManager.spec.ts somewhere.

describe('postfixFiles', () => {
    it('skips "common:/" paths', async () => {
        let project = new ComponentLibraryProject(params);
        project.fileMappings = [];
        fsExtra.outputFileSync(`${params.stagingFolderPath}/source/main.brs`, '');
        fsExtra.outputFileSync(`${params.stagingFolderPath}/components/Component1.xml`, `
            <component name="CustomComponent" extends="Rectangle">
                <script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/>
                <script type="text/brightscript" uri="CustomComponent.brs"/>
                <script type="text/brightscript" uri="pkg:/source/utils.brs"/>
            </component>
        `);
        await project.postfixFiles();
        expect(
            fsExtra.readFileSync(`${params.stagingFolderPath}/components/Component1.xml`).toString()
        ).to.eql(`
            <component name="CustomComponent" extends="Rectangle">
                <script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/>
                <script type="text/brightscript" uri="CustomComponent__lib0.brs"/>
                <script type="text/brightscript" uri="pkg:/source/utils__lib0.brs"/>
            </component>
        `);
    });
});
philandersonaccedo commented 1 year ago

Picking up this ticket for investigation

philandersonaccedo commented 1 year ago

Notes on 1-1 session