docs: function createScope(file, flow, module){
    if (file.type != 'script' || file.jsScope)
      return;
  
    var exports;
  
    if (!module)
    {
      exports = { type: 'ObjectExpression', properties: [] };
      module = {
        type: 'ObjectExpression',
        properties: [
          {
            type: 'Property',
            key: utils.createIdentifier('exports'),
            computed: false,
            value: exports,
            kind: 'init',
            method: false,
            shorthand: false
          }
        ]
      };
      module.obj = {
        exports: exports
      };
    }
    else
    {
      exports = module.obj.exports;
    }
  
    var scope = new at.Scope('function', flow.js.globalScope, exports);
    var basisResource = flow.js.basisScope.resolve(utils.memberExpression('basis', 'resource'));
    var basisRequire = flow.js.basisScope.resolve(utils.memberExpression('basis', 'require'));
    var baseURI = utils.createLiteral(file.baseURI.replace(/\/$/, ''));
  
    var names = {
      module: module,
      exports: exports,
      __filename: utils.createLiteral(file.filename),
      __dirname: utils.createLiteral(file.dirname),
      global: flow.js.globalScope.get('global').token,
      basis: flow.js.basisScope.get('basis').token,
      resource: at.createRunner(function(token, this_, args, scope){
        // resource(path) -> basis.resource(__dirname + path)
        var filename = resolveString(scope, args[0]);
        var baseURI = args[1] ? resolveString(scope, args[1]) : false;
  
        if (typeof filename == 'string')
        {
          filename = basisResolveURI // since 1.4
            ? basisResolveURI(filename, baseURI || file.baseURI, 'resource(\'{url}\')')
            : relToIndex(flow, filename, file.baseURI);
  
          args = [utils.createLiteral(filename)];
        }
  
        basisResource.run.call(this, token, this_, args, scope);
      }),
      require: at.createRunner(function(token, this_, args){
        // require(path, base) -> basis.require(path, base || "__dirname")
        args = [
          args[0],
          args[1] || utils.cloneNode(baseURI)
        ];
        basisRequire.run.call(this, token, this_, args, scope);
      })
    };
  
    // local `asset` function supported since 1.4
    if (basisResolveURI)
    {
      names.asset = at.createRunner(function(token, this_, args, scope){
        asset(flow, file, file.baseURI, scope, args, token, 'asset(\'{url}\')');
      });
    }
  
    for (var name in names)
      scope.put(name, {
        type: 'arg',
        token: names[name]
      });
  
    file.jsScope = scope;
    scope.strict = true;
    scope.implicit = true;
  }